diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 28b49a19..cdb12891 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' @@ -30,25 +30,28 @@ 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/upload-artifact@v4.3.1 with: 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@v3 + - uses: actions/checkout@v4.1.1 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 @@ -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@v1.8 + 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@v3 - with: - fetch-depth: 0 - - name: Download Artifact - uses: actions/download-artifact@v3 - with: - name: web - path: service/server/router/web - - name: Set up Go - uses: actions/setup-go@v3 - 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@v1.8 - with: - path: v2raya_bin/* - - Build_on_macOS: - runs-on: macos-latest - needs: Build_v2rayA_Web - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Download Artifact - uses: actions/download-artifact@v3 - with: - name: web - path: service/server/router/web - - name: Set up Go - uses: actions/setup-go@v3 - 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@v1.8 - with: - path: v2raya_bin/* + path: v2raya_bin/* \ No newline at end of file diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index c2fb5c25..aabd258e 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' @@ -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/upload-artifact@v4.3.1 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 @@ -102,11 +102,11 @@ 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 - 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 }} @@ -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 @@ -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 @@ -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 @@ -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/* @@ -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 @@ -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 @@ -423,11 +423,15 @@ 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/* + 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 }}" --generate-notes + fi + gh release upload "v${{ steps.prep.outputs.VERSION }}" release/* - name: Refresh Cloudflare Cache env: CF_AUTH_EMAIL: ${{ secrets.CF_AUTH_EMAIL }} @@ -588,7 +592,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/* @@ -600,7 +604,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 @@ -612,7 +616,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 @@ -681,7 +685,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 @@ -693,17 +697,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 @@ -734,7 +738,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 +780,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 @@ -790,7 +794,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 @@ -819,7 +823,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