From b02526bcf1751562d39d03c162b9a237f29e1549 Mon Sep 17 00:00:00 2001 From: fscarmen <62703343+fscarmen@users.noreply.github.com> Date: Fri, 24 Mar 2023 22:24:53 +0800 Subject: [PATCH] Update wireguard-go.yml --- .github/workflows/wireguard-go.yml | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/wireguard-go.yml b/.github/workflows/wireguard-go.yml index 79b02cd..8b6a66f 100644 --- a/.github/workflows/wireguard-go.yml +++ b/.github/workflows/wireguard-go.yml @@ -14,8 +14,6 @@ jobs: env: WORKDIR: ./wireguard-go-source - USERNAME: ${{ secrets.GH_USERNAME }} - EMAIL: ${{ secrets.GH_EMAIL }} steps: - name: Checkout code @@ -25,7 +23,7 @@ jobs: - name: Check the official latest version of WireGuard-go run: | - NOW=$(wget -qO- "https://api.github.com/repos/${{ env.USERNAME }}/warp/releases" | grep "tag_name" | grep -i "wireguard-go" | head -n 1 | sed "s/.*_v\(.*\)\".*/\1/g") + NOW=$(wget -qO- "https://api.github.com/repos/${{ github.repository }}/releases" | grep "tag_name" | grep -i "wireguard-go" | head -n 1 | sed "s/.*_v\(.*\)\".*/\1/g") LATEST=$(wget -qO- https://git.zx2c4.com/wireguard-go/ | grep '/wireguard-go/tag' | sed -n 1p | sed "s/.*>\([0-9.]\{1,\}\)<.*/\1/g") if [ "$LATEST" != "$NOW" ]; then @@ -33,6 +31,7 @@ jobs: cp .github/wireguard-go-releaser.yml ${{ env.WORKDIR }}/.goreleaser.yml echo "VERSION=$LATEST" >> $GITHUB_ENV echo "flags=--snapshot" >> $GITHUB_ENV + echo "DATE=$(date "+%Y/%m/%d %H:%M:%S")" >> $GITHUB_ENV fi - name: Set up GoReleaser @@ -51,6 +50,12 @@ jobs: args: release --clean ${{ env.flags }} env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + + - name: Upload to repository + uses: stefanzweifel/git-auto-commit-action@v4.16.0 + if: ${{ env.VERSION != '' }} + with: + commit_message: Sync Wireguard-go to V${{ env.VERSION }} by Github Actions, ${{ env.DATE }} - name: Release binaries uses: softprops/action-gh-release@v1 @@ -58,14 +63,3 @@ jobs: with: tag_name: WireGuard-go_v${{ env.VERSION }} files: ${{ env.WORKDIR }}/dist/*.tar.gz - - - name: Upload to REPO - if: ${{ env.VERSION != '' }} - run: | - cp -f ${{ env.WORKDIR }}/dist/*.tar.gz ${GITHUB_WORKSPACE}/wireguard-go/ - rm -rf ${{ env.WORKDIR }} - git config --global user.email "${{ env.EMAIL }}" - git config --global user.name "${{ env.USERNAME }}" - git add . - git commit -m "Wireguard-go V${{ env.VERSION }}, $(date "+%Y/%m/%d")" - git push