From 9be80edad112b29691f4f8d23b80d7e457d8fe41 Mon Sep 17 00:00:00 2001 From: fscarmen <62703343+fscarmen@users.noreply.github.com> Date: Sat, 25 Mar 2023 00:10:30 +0800 Subject: [PATCH] Update sync_wireproxy.yml --- .github/workflows/sync_wireproxy.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/sync_wireproxy.yml b/.github/workflows/sync_wireproxy.yml index 166af09..deb69a2 100644 --- a/.github/workflows/sync_wireproxy.yml +++ b/.github/workflows/sync_wireproxy.yml @@ -8,35 +8,34 @@ on: jobs: build: name: Sync wireproxy latest version + runs-on: ubuntu-latest + env: - USERNAME: ${{ secrets.GH_USERNAME }} - EMAIL: ${{ secrets.GH_EMAIL }} + FILE_DIR: wireproxy steps: - uses: actions/checkout@v3.4.0 - name: Update wireproxy to latest version run: | - NOW=$(wget -qO- https://raw.githubusercontent.com/${{ env.USERNAME }}/warp/main/wireproxy/version_history | head -n 1 | sed "s/.*v\(.*\)/\1/g") + 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 ${GITHUB_WORKSPACE}/wireproxy ] && mkdir -p ${GITHUB_WORKSPACE}/wireproxy + [ ! -d ${{ env.FILE_DIR }} ] && mkdir -p ${{ env.FILE_DIR }} PLATFORM=( "linux_amd64" "linux_arm64" "linux_s390x" ) for i in "${PLATFORM[@]}"; do - wget -O ${GITHUB_WORKSPACE}/wireproxy/wireproxy_"$i".tar.gz https://github.com/octeep/wireproxy/releases/download/v"$LATEST"/wireproxy_"$i".tar.gz + 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" ${GITHUB_WORKSPACE}/wireproxy/version_history + 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 REPO + + - name: Upload to repository + uses: stefanzweifel/git-auto-commit-action@v4.16.0 if: ${{ env.VERSION != '' }} - run: | - git config --global user.email "${{ env.EMAIL }}" - git config --global user.name "${{ env.USERNAME }}" - git add . - git commit -m "Sync wireproxy to V${{ env.VERSION }} by Github Actions, $(date "+%Y/%m/%d %H:%M:%S")" - git push + with: + commit_message: Sync wireproxy to V${{ env.VERSION }} by Github Actions, ${{ env.DATE }}