-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (32 loc) · 1.5 KB
/
sync_wireproxy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: Synchronize wireproxy
on:
workflow_dispatch:
schedule:
- cron: '13 2 * * *'
jobs:
build:
name: Synchronize wireproxy
runs-on: ubuntu-latest
env:
FILE_DIR: wireproxy
steps:
- uses: actions/checkout@v4.1.5
- name: Synchronize wireproxy to the latest version
run: |
NOW=$(wget -qO- https://raw.githubusercontent.com/${{ github.repository }}/main/wireproxy/version_history | head -n 1 | sed "s/.*v\(.*\)/\1/g")
LATEST=$(wget -qO- "https://api.github.com/repos/octeep/wireproxy/releases/latest" | grep "tag_name" | head -n 1 | cut -d : -f2 | sed 's/[ \"v,]//g')
if [ "$LATEST" != "$NOW" ]; then
[ ! -d ${{ env.FILE_DIR }} ] && mkdir -p ${{ env.FILE_DIR }}
PLATFORM=( "linux_amd64" "linux_arm64" "linux_s390x" )
for i in "${PLATFORM[@]}"; do
wget -O ${{ env.FILE_DIR }}/wireproxy_"$i".tar.gz https://github.com/octeep/wireproxy/releases/download/v"$LATEST"/wireproxy_"$i".tar.gz
done
sed -i "1i$(date "+%Y/%m/%d") v$LATEST" ${{ env.FILE_DIR }}/version_history || true
echo "VERSION=$LATEST" >> $GITHUB_ENV
echo "DATE=$(date "+%Y/%m/%d %H:%M:%S")" >> $GITHUB_ENV
fi
- name: Upload to repository
uses: stefanzweifel/git-auto-commit-action@v5.0.1
if: ${{ env.VERSION != '' }}
with:
commit_message: Sync wireproxy to V${{ env.VERSION }} by Github Actions, ${{ env.DATE }}