From 65fa1db673fbe291402575d232b2d41cb0c418c7 Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Thu, 22 Feb 2024 20:54:47 +0800 Subject: [PATCH 1/5] ci: update actions/checkout@v3 to v4.1.1 --- .github/workflows/pull_request.yml | 10 +++++----- .github/workflows/release_main.yml | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 28b49a19..9c0179bc 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -11,11 +11,11 @@ jobs: Build_v2rayA_Web: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4.0.2 with: node-version: lts/* cache: 'yarn' @@ -39,7 +39,7 @@ jobs: runs-on: ubuntu-22.04 needs: Build_v2rayA_Web steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Download Artifact @@ -74,7 +74,7 @@ jobs: runs-on: windows-latest needs: Build_v2rayA_Web steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Download Artifact @@ -109,7 +109,7 @@ jobs: runs-on: macos-latest needs: Build_v2rayA_Web steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Download Artifact diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index c2fb5c25..ca77ce51 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -21,11 +21,11 @@ jobs: Build_v2rayA_Web: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Set up Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4.0.2 with: node-version: lts/* cache: 'yarn' @@ -102,7 +102,7 @@ jobs: NAME: v2raya DESC: "A web GUI client of Project V which supports VMess, VLESS, SS, SSR, Trojan, Tuic and Juicity protocols" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Download Artifact @@ -162,7 +162,7 @@ jobs: runs-on: windows-latest needs: [Build_v2rayA_Binaries] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Check Version @@ -265,7 +265,7 @@ jobs: NAME: v2raya DESC: "A web GUI client of Project V which supports VMess, VLESS, SS, SSR, Trojan, Tuic and Juicity protocols" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Get Friendly File Name @@ -385,7 +385,7 @@ jobs: runs-on: ubuntu-22.04 needs: [Build_v2rayA_Binaries, Build_Windows_Installers, Build_Linux_Packages] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Check Version @@ -600,7 +600,7 @@ jobs: needs: [Build_v2rayA_Binaries, Build_Linux_Packages, Build_v2ray_Debian_Packages] if: startsWith(github.ref, 'refs/tags/v') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Check Version @@ -681,7 +681,7 @@ jobs: needs: [Build_v2rayA_Binaries] if: startsWith(github.ref, 'refs/tags/v') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Check Version @@ -734,7 +734,7 @@ jobs: needs: [GitHub_Release] if: startsWith(github.ref, 'refs/tags/v') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Check Version @@ -776,7 +776,7 @@ jobs: needs: [Build_v2rayA_Web] if: startsWith(github.ref, 'refs/tags/v') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Check Version @@ -819,7 +819,7 @@ jobs: needs: [GitHub_Release] if: startsWith(github.ref, 'refs/tags/v') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Check Version From aff98dad379b7c490b60c8a67fd66c133ae9b761 Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Thu, 22 Feb 2024 22:18:01 +0800 Subject: [PATCH 2/5] ci: update node16 to node 20 --- .github/workflows/pull_request.yml | 20 ++++++++--------- .github/workflows/release_main.yml | 36 +++++++++++++++--------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 9c0179bc..c2bbcff9 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -30,7 +30,7 @@ jobs: echo "Use tar to generate web.tar.gz..." tar -zcvf web.tar.gz web/ - name: Upload Zip File to Artifacts - uses: actions/upload-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: path: web/* name: web @@ -43,12 +43,12 @@ jobs: with: fetch-depth: 0 - name: Download Artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: name: web path: service/server/router/web - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5.0.0 with: go-version: ^1.21 - name: Build v2rayA @@ -66,7 +66,7 @@ jobs: GOARCH="$arch" CGO_ENABLED=0 go build -tags "with_gvisor" -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CurrentDir"/v2raya_bin/v2raya_pr_build_"$os"_"$arch"_"$version" done - name: Upload Zip File to Artifacts - uses: nanoufo/action-upload-artifacts-and-release-assets@v1.8 + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 with: path: v2raya_bin/* @@ -78,12 +78,12 @@ jobs: with: fetch-depth: 0 - name: Download Artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: name: web path: service/server/router/web - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5.0.0 with: go-version: ^1.21 - name: Build v2rayA @@ -101,7 +101,7 @@ jobs: GOARCH="$arch" CGO_ENABLED=0 go build -tags "with_gvisor" -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CurrentDir"/v2raya_bin/v2raya_pr_build_"$os"_"$arch"_"$version".exe done - name: Upload Zip File to Artifacts - uses: nanoufo/action-upload-artifacts-and-release-assets@v1.8 + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 with: path: v2raya_bin/* @@ -113,12 +113,12 @@ jobs: with: fetch-depth: 0 - name: Download Artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: name: web path: service/server/router/web - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5.0.0 with: go-version: ^1.21 - name: Build v2rayA @@ -136,6 +136,6 @@ jobs: GOARCH="$arch" CGO_ENABLED=0 go build -tags "with_gvisor" -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CurrentDir"/v2raya_bin/v2raya_pr_build_"$os"_"$arch"_"$version" done - name: Upload Zip File to Artifacts - uses: nanoufo/action-upload-artifacts-and-release-assets@v1.8 + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 with: path: v2raya_bin/* diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index ca77ce51..654a6e82 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -40,12 +40,12 @@ jobs: echo "Use tar to generate web.tar.gz..." tar -zcvf web.tar.gz web/ - name: Upload Zip File to Artifacts - uses: actions/upload-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: path: web/* name: web - name: Upload the tar archive to Artifacts - uses: nanoufo/action-upload-artifacts-and-release-assets@v1.8 + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 with: path: | web.tar.gz @@ -106,7 +106,7 @@ jobs: with: fetch-depth: 0 - name: Download Artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: name: web path: service/server/router/web @@ -135,7 +135,7 @@ jobs: echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v5.0.0 with: go-version: ^1.21 - name: Install Dependencies @@ -154,7 +154,7 @@ jobs: cd .. mv build_"$GOOS"_"$GOARCH""$GOARM"_"$VERSION""$WIN_SUF" v2raya_"${{ steps.get_filename.outputs.BUILD_NAME }}"_"$VERSION""$WIN_SUF" - name: Upload Artifact - uses: nanoufo/action-upload-artifacts-and-release-assets@v1.8 + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 with: path: | v2raya_${{ steps.get_filename.outputs.BUILD_NAME }}_${{ steps.prep.outputs.VERSION }}${{ matrix.win_suf }} @@ -184,12 +184,12 @@ jobs: echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifact Windows x64 - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: name: v2raya_windows_x64_${{ steps.prep.outputs.VERSION }}.exe path: D:\Downloads - name: Download Artifact Windows arm64 - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: name: v2raya_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe path: D:\Downloads @@ -241,7 +241,7 @@ jobs: Copy-Item -Path D:\installer_windows_inno_x64.exe -Destination .\installer_windows_inno_x64_${{ steps.prep.outputs.VERSION }}.exe Copy-Item -Path D:\installer_windows_inno_arm64.exe -Destination .\installer_windows_inno_arm64_${{ steps.prep.outputs.VERSION }}.exe - name: Upload Artifact - uses: nanoufo/action-upload-artifacts-and-release-assets@v1.8 + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 with: path: | installer_windows_inno_x64_${{ steps.prep.outputs.VERSION }}.exe @@ -300,12 +300,12 @@ jobs: echo "PACKAGE_VERSION=$package_version" >> $GITHUB_OUTPUT echo "PACKAGE_VERSION=$package_version" >> $GITHUB_ENV - name: Download Artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: name: v2raya_${{ steps.get_filename.outputs.BUILD_NAME }}_${{ steps.prep.outputs.VERSION }} path: build/ - name: Download x64 Linux Build - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: name: v2raya_linux_x64_${{ steps.prep.outputs.VERSION }} path: test/ @@ -376,7 +376,7 @@ jobs: mv installer_linux_$GOARCH$GOAMD64$GOARM_${{ steps.prep.outputs.VERSION }}.deb \ fpm_packages/installer_debian_${{ steps.get_filename.outputs.FRIENDLY_ARCH }}_${{ steps.prep.outputs.VERSION }}.deb - name: Upload Artifact - uses: nanoufo/action-upload-artifacts-and-release-assets@v1.8 + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 with: path: | fpm_packages/* @@ -400,7 +400,7 @@ jobs: echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: path: builds/ - name: Move Files to Release Directory @@ -588,7 +588,7 @@ jobs: echo "XRAY_VERSION=$XRAY_VERSION" >> ./xray_packages_version.txt - name: Upload Artifact - uses: nanoufo/action-upload-artifacts-and-release-assets@v1.8 + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 with: path: | v2ray_packages/* @@ -612,7 +612,7 @@ jobs: echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: path: builds/ - name: Prepare Builds @@ -693,17 +693,17 @@ jobs: echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifact Linux x64 - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: name: v2raya_linux_x64_${{ steps.prep.outputs.VERSION }} path: Downloads - name: Download Artifact macOS x64 - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: name: v2raya_darwin_x64_${{ steps.prep.outputs.VERSION }} path: Downloads - name: Download Artifact macOS arm64 - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: name: v2raya_darwin_arm64_${{ steps.prep.outputs.VERSION }} path: Downloads @@ -790,7 +790,7 @@ jobs: IMAGE="mzz2017/v2raya-gui" echo image=${IMAGE} >> $GITHUB_OUTPUT - name: Download Web Files - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4.1.2 with: name: web path: web From 43f9b81ce38878a3f0afedd8fea4e802ae7257da Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Thu, 22 Feb 2024 23:00:34 +0800 Subject: [PATCH 3/5] ci: fix download releases --- .github/workflows/pull_request.yml | 2 +- .github/workflows/release_main.yml | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index c2bbcff9..b07f8217 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -30,7 +30,7 @@ jobs: echo "Use tar to generate web.tar.gz..." tar -zcvf web.tar.gz web/ - name: Upload Zip File to Artifacts - uses: actions/download-artifact@v4.1.2 + uses: actions/upload-artifact@v4.3.1 with: path: web/* name: web diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index 654a6e82..1667ee3e 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -40,7 +40,7 @@ jobs: echo "Use tar to generate web.tar.gz..." tar -zcvf web.tar.gz web/ - name: Upload Zip File to Artifacts - uses: actions/download-artifact@v4.1.2 + uses: actions/upload-artifact@v4.3.1 with: path: web/* name: web @@ -423,11 +423,14 @@ jobs: Move-Item ./web.zip ./release/web.zip Move-Item ./web.zip.sha256.txt ./release/web.zip.sha256.txt - name: Upload Release - uses: softprops/action-gh-release@v1 - with: - tag_name: v${{ steps.prep.outputs.VERSION }} - files: | - release/* + run: | + Latest_Releases=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/v2rayA/v2rayA/releases/latest | jq -r '.tag_name') + Latest_tag=v${{ steps.prep.outputs.VERSION }} + if [ "$Latest_Releases" != "$Latest_tag" ]; then + gh release create "v${{ steps.prep.outputs.VERSION }}" -t "v${{ steps.prep.outputs.VERSION }}" \ + --notes "Release v${{ steps.prep.outputs.VERSION }}" + fi + gh release upload "v${{ steps.prep.outputs.VERSION }}" release/* - name: Refresh Cloudflare Cache env: CF_AUTH_EMAIL: ${{ secrets.CF_AUTH_EMAIL }} From 5c2f80d7c2f59df2270de13aa0c413733abfd272 Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Thu, 22 Feb 2024 23:09:47 +0800 Subject: [PATCH 4/5] ci: fix upload github releases --- .github/workflows/release_main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index 1667ee3e..aabd258e 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -423,12 +423,13 @@ jobs: Move-Item ./web.zip ./release/web.zip Move-Item ./web.zip.sha256.txt ./release/web.zip.sha256.txt - name: Upload Release + env: + GH_TOKEN: ${{ github.token }} run: | Latest_Releases=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/v2rayA/v2rayA/releases/latest | jq -r '.tag_name') Latest_tag=v${{ steps.prep.outputs.VERSION }} if [ "$Latest_Releases" != "$Latest_tag" ]; then - gh release create "v${{ steps.prep.outputs.VERSION }}" -t "v${{ steps.prep.outputs.VERSION }}" \ - --notes "Release v${{ steps.prep.outputs.VERSION }}" + gh release create "v${{ steps.prep.outputs.VERSION }}" -t "v${{ steps.prep.outputs.VERSION }}" --generate-notes fi gh release upload "v${{ steps.prep.outputs.VERSION }}" release/* - name: Refresh Cloudflare Cache From 42f766efd28a2264b487bdc6ba8acfbe1dd5dcda Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Fri, 23 Feb 2024 07:13:40 +0800 Subject: [PATCH 5/5] ci: better PR workflow --- .github/workflows/pull_request.yml | 90 +++++------------------------- 1 file changed, 15 insertions(+), 75 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index b07f8217..cdb12891 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -35,8 +35,11 @@ jobs: path: web/* name: web - Build_on_Linux: - runs-on: ubuntu-22.04 + Build_v2rayA: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] needs: Build_v2rayA_Web steps: - uses: actions/checkout@v4.1.1 @@ -60,82 +63,19 @@ jobs: count=$(git -C "$CurrentDir" rev-list --count HEAD) commit=$(git -C "$CurrentDir" rev-parse --short HEAD) version="unstable-$date.r${count}.$commit" - os="linux" + if [ "${{ matrix.os }}" = "windows-latest" ]; then + win_ex_name=".exe" + os="windows" + elif [ "${{ matrix.os }}" = "macos-latest" ]; then + os="darwin" + elif [ "${{ matrix.os }}" = "ubuntu-latest" ]; then + os="linux" + fi cd "$CurrentDir"/service for arch in amd64 arm64; do - GOARCH="$arch" CGO_ENABLED=0 go build -tags "with_gvisor" -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CurrentDir"/v2raya_bin/v2raya_pr_build_"$os"_"$arch"_"$version" + GOARCH="$arch" CGO_ENABLED=0 go build -tags "with_gvisor" -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CurrentDir"/v2raya_bin/v2raya_pr_build_"$os"_"$arch"_"$version""$win_ex_name" done - name: Upload Zip File to Artifacts uses: nanoufo/action-upload-artifacts-and-release-assets@v2 with: - path: v2raya_bin/* - - Build_on_Windows: - runs-on: windows-latest - needs: Build_v2rayA_Web - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 0 - - name: Download Artifact - uses: actions/download-artifact@v4.1.2 - with: - name: web - path: service/server/router/web - - name: Set up Go - uses: actions/setup-go@v5.0.0 - with: - go-version: ^1.21 - - name: Build v2rayA - shell: bash - run: | - mkdir v2raya_bin - CurrentDir="$(pwd)" - date=$(git -C "$CurrentDir" log -1 --format="%cd" --date=short | sed s/-//g) - count=$(git -C "$CurrentDir" rev-list --count HEAD) - commit=$(git -C "$CurrentDir" rev-parse --short HEAD) - version="unstable-$date.r${count}.$commit" - os="windows" - cd "$CurrentDir"/service - for arch in amd64 arm64; do - GOARCH="$arch" CGO_ENABLED=0 go build -tags "with_gvisor" -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CurrentDir"/v2raya_bin/v2raya_pr_build_"$os"_"$arch"_"$version".exe - done - - name: Upload Zip File to Artifacts - uses: nanoufo/action-upload-artifacts-and-release-assets@v2 - with: - path: v2raya_bin/* - - Build_on_macOS: - runs-on: macos-latest - needs: Build_v2rayA_Web - steps: - - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 0 - - name: Download Artifact - uses: actions/download-artifact@v4.1.2 - with: - name: web - path: service/server/router/web - - name: Set up Go - uses: actions/setup-go@v5.0.0 - with: - go-version: ^1.21 - - name: Build v2rayA - shell: bash - run: | - mkdir v2raya_bin - CurrentDir="$(pwd)" - date=$(git -C "$CurrentDir" log -1 --format="%cd" --date=short | sed s/-//g) - count=$(git -C "$CurrentDir" rev-list --count HEAD) - commit=$(git -C "$CurrentDir" rev-parse --short HEAD) - version="unstable-$date.r${count}.$commit" - os="darwin" - cd "$CurrentDir"/service - for arch in amd64 arm64; do - GOARCH="$arch" CGO_ENABLED=0 go build -tags "with_gvisor" -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CurrentDir"/v2raya_bin/v2raya_pr_build_"$os"_"$arch"_"$version" - done - - name: Upload Zip File to Artifacts - uses: nanoufo/action-upload-artifacts-and-release-assets@v2 - with: - path: v2raya_bin/* + path: v2raya_bin/* \ No newline at end of file