From e253122bd451513ce8c0fd3580490581ee7f56ec Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Tue, 16 Apr 2024 20:33:56 +0800 Subject: [PATCH 01/16] ci: add singtun builds --- .github/workflows/pull_request.yml | 6 +- .github/workflows/release_main.yml | 214 ++++++++++++++++++----------- 2 files changed, 134 insertions(+), 86 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 77bf043e..263a1ee8 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -11,7 +11,7 @@ jobs: Build_v2rayA_Web: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4.1.1 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Node.js @@ -42,7 +42,7 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] needs: Build_v2rayA_Web steps: - - uses: actions/checkout@v4.1.1 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Download Artifact @@ -51,7 +51,7 @@ jobs: name: web path: service/server/router/web - name: Set up Go - uses: actions/setup-go@v5.0.0 + uses: actions/setup-go@v5 with: cache-dependency-path: | service/go.mod diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index 9406765d..a2573988 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -21,7 +21,7 @@ jobs: Build_v2rayA_Web: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4.1.1 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Node.js @@ -50,59 +50,14 @@ jobs: path: | web.tar.gz Build_v2rayA_Binaries: - strategy: - matrix: - goos: [ linux ] - goarch: [ amd64, arm64, 386, riscv64, mips64, mips64le, mipsle, mips, loong64 ] - include: - # BEGIN Linux ARM 5 6 7 - - goos: linux - goarch: arm - goarm: 7 - - goos: linux - goarch: arm - goarm: 6 - - goos: linux - goarch: arm - goarm: 5 - # END Linux ARM 5 6 7 - # BEGIN Windows - - goos: windows - goarch: amd64 - win_suf: .exe - - goos: windows - goarch: arm64 - win_suf: .exe - # END Windows - # BEGIN macOS - - goos: darwin - goarch: amd64 - - goos: darwin - goarch: arm64 - # END macOS - # BEGIN BSD - - goos: freebsd - goarch: amd64 - - goos: freebsd - goarch: arm64 - - goos: openbsd - goarch: amd64 - - goos: openbsd - goarch: arm64 - # END BSD - fail-fast: false - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest needs: [Build_v2rayA_Web] env: - GOOS: ${{ matrix.goos }} - GOARCH: ${{ matrix.goarch }} - GOARM: ${{ matrix.goarm }} - WIN_SUF: ${{ matrix.win_suf }} CGO_ENABLED: 0 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@v4.1.1 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Download Artifact @@ -110,17 +65,11 @@ jobs: with: name: web path: service/server/router/web - - name: Get Friendly File Name - shell: pwsh - id: get_filename - run: | - $build_name = $(((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm }}").friendlyName) - Write-Output "BUILD_NAME=$build_name" >> ${env:GITHUB_OUTPUT} - Write-Output "BUILD_NAME=$build_name" >> ${env:GITHUB_ENV} - name: Check Version id: prep env: REF: ${{ github.ref }} + shell: bash run: | echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT if [[ "$REF" == "refs/tags/v"* ]]; then @@ -135,37 +84,136 @@ jobs: echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Set up Go - uses: actions/setup-go@v5.0.0 + uses: actions/setup-go@v5 with: cache-dependency-path: | service/go.mod service/go.sum go-version: ^1.21 - - name: Install Dependencies - run: | - sudo apt-get update -y && sudo apt-get install -y gzip - name: Build v2rayA Binaries id: build + shell: pwsh run: | - for file in $(find service/server/router/web |grep -v png |grep -v index.html|grep -v .gz); do - if [ ! -d $file ];then - gzip -9 $file - fi - done - cd service - go build -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=$VERSION -s -w" -o ../build_"$GOOS"_"$GOARCH""$GOARM"_"$VERSION""$WIN_SUF" - cd .. - mv build_"$GOOS"_"$GOARCH""$GOARM"_"$VERSION""$WIN_SUF" v2raya_"${{ steps.get_filename.outputs.BUILD_NAME }}"_"$VERSION""$WIN_SUF" + New-Item -ItemType Directory -Path v2raya_binaries + foreach ($arch in @('amd64', 'arm64', 'arm', '386', 'riscv64', 'mips64', 'mips64le', 'mipsle', 'mips', 'loong64')) { + Set-Location -Path service + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-$arch")."friendlyName" + go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arm in @('7')) { + Set-Location -Path service + $env:GOARCH = 'arm' + $env:GOARM = $arm + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-arm$arm")."friendlyName" + go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'windows' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."windows-$arch")."friendlyName" + go build -o ../v2raya_binaries/v2raya_$filename.exe -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'darwin' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."darwin-$arch")."friendlyName" + go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'freebsd' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."freebsd-$arch")."friendlyName" + go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'openbsd' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."openbsd-$arch")."friendlyName" + go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + } + - name: Upload Artifact 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 }} + v2raya_binaries/* + Build_v2rayA_SingTun_Binaries: + runs-on: ubuntu-latest + needs: [Build_v2rayA_Web] + env: + CGO_ENABLED: 0 + 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@v4 + with: + fetch-depth: 0 + - name: Download Artifact + uses: actions/download-artifact@v4.1.2 + with: + name: web + path: service/server/router/web + - name: Check Version + id: prep + env: + REF: ${{ github.ref }} + shell: bash + run: | + echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT + if [[ "$REF" == "refs/tags/v"* ]]; then + tag=$(git describe --tags $(git rev-list --tags --max-count=1)) + version=${tag:1} + else + date=$(git log -1 --format="%cd" --date=short | sed s/-//g) + count=$(git rev-list --count HEAD) + commit=$(git rev-parse --short HEAD) + version="unstable-$date.r${count}.$commit" + fi + echo "VERSION=$version" >> $GITHUB_OUTPUT + echo "VERSION=$version" >> $GITHUB_ENV + - name: Set up Go + uses: actions/setup-go@v5 + with: + cache-dependency-path: | + service/go.mod + service/go.sum + go-version: ^1.21 + - name: Build v2rayA SingTun Binaries + shell: pwsh + run: | + New-Item -ItemType Directory -Path v2raya_binaries + foreach ($arch in @('amd64', 'arm64')) { + Set-Location -Path service + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-$arch")."friendlyName" + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'windows' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."windows-$arch")."friendlyName" + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_$filename.exe -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'darwin' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."darwin-$arch")."friendlyName" + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + } + - name: Upload Artifact + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 + with: + path: | + v2raya_binaries/* Build_Windows_Installers: runs-on: windows-latest - needs: [Build_v2rayA_Binaries] + needs: [Build_v2rayA_SingTun_Binaries] steps: - - uses: actions/checkout@v4.1.1 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check Version @@ -189,12 +237,12 @@ jobs: - name: Download Artifact Windows x64 uses: actions/download-artifact@v4.1.2 with: - name: v2raya_windows_x64_${{ steps.prep.outputs.VERSION }}.exe + name: v2raya_with_singtun_windows_x64_${{ steps.prep.outputs.VERSION }}.exe path: D:\Downloads - name: Download Artifact Windows arm64 uses: actions/download-artifact@v4.1.2 with: - name: v2raya_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe + name: v2raya_with_singtun_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe path: D:\Downloads - name: Install Inno Setup shell: pwsh @@ -209,8 +257,8 @@ jobs: New-Item -ItemType Directory -Path "D:\v2raya-arm64-windows\data" New-Item -ItemType Directory -Path "D:\v2raya-arm64-windows\bin" ## Copy v2rayA to Destination Directory - Copy-Item -Path D:\Downloads\v2raya_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-arm64-windows\bin\v2raya.exe - Copy-Item -Path D:\Downloads\v2raya_windows_x64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-x86_64-windows\bin\v2raya.exe + Copy-Item -Path D:\Downloads\v2raya_with_singtun_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-arm64-windows\bin\v2raya.exe + Copy-Item -Path D:\Downloads\v2raya_with_singtun_windows_x64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-x86_64-windows\bin\v2raya.exe Copy-Item -Path ".\install\windows-inno\v2raya.ico" -Destination "D:\v2raya.ico" ## Download and extract v2ray $Url_v2ray_x64 = "https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-windows-64.zip" @@ -268,7 +316,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@v4.1.1 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Get Friendly File Name @@ -386,9 +434,9 @@ jobs: GitHub_Release: if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-22.04 - needs: [Build_v2rayA_Binaries, Build_Windows_Installers, Build_Linux_Packages] + needs: [Build_v2rayA_Binaries, Build_Windows_Installers, Build_Linux_Packages, Build_v2rayA_SingTun_Binaries] steps: - - uses: actions/checkout@v4.1.1 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check Version @@ -607,7 +655,7 @@ jobs: needs: [Build_v2rayA_Binaries, Build_Linux_Packages, Build_v2ray_Debian_Packages] if: startsWith(github.ref, 'refs/tags/v') steps: - - uses: actions/checkout@v4.1.1 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check Version @@ -688,7 +736,7 @@ jobs: needs: [Build_v2rayA_Binaries] if: startsWith(github.ref, 'refs/tags/v') steps: - - uses: actions/checkout@v4.1.1 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check Version @@ -741,7 +789,7 @@ jobs: needs: [GitHub_Release] if: startsWith(github.ref, 'refs/tags/v') steps: - - uses: actions/checkout@v4.1.1 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check Version @@ -783,7 +831,7 @@ jobs: needs: [Build_v2rayA_Web] if: startsWith(github.ref, 'refs/tags/v') steps: - - uses: actions/checkout@v4.1.1 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check Version @@ -826,7 +874,7 @@ jobs: needs: [GitHub_Release] if: startsWith(github.ref, 'refs/tags/v') steps: - - uses: actions/checkout@v4.1.1 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Check Version From 1c486b40cc7d799e5786d84d6ded809b69a2ce76 Mon Sep 17 00:00:00 2001 From: Valeriy Manzhos <47538801+InvisibleRain@users.noreply.github.com> Date: Mon, 17 Jun 2024 22:21:12 +0300 Subject: [PATCH 02/16] chore(docker): Publish docker images on Github Container Registry (#1425) * Temporary test * Push containers to ghcr.io via GitHub Actions * replace tabs with spaces * temporary comment out dockerhub * temporary comment out dockerhub for gui * revertme: remove non-ghcr docker image tags * convert repo owner name to lowercase * fix conversion to lowercase * fix typo, move lowercase conversion to calculate sooner * copy lowercase conversion to both jobs * fix typo * add labels to gui and dev Dockerfiles * specify correct push path for the ghcr.io * fix typo * hardcode image name * specify correct labels for upstream * add dockerhub tags * uncomment dockerhub login * restore Dockerfile.dev --- .github/workflows/release_main.yml | 24 +++++++++++++++++++++++- Dockerfile | 1 + Dockerfile.gui | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index 9406765d..5d72cabe 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -760,11 +760,20 @@ jobs: uses: docker/setup-qemu-action@v3.0.0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.0.0 + - name: Login to GitHub container registry + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Login to DockerHub uses: docker/login-action@v3.0.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Convert repository owner to lowercase + run: | + echo "LOWERCASE_REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER@L}" >>${GITHUB_ENV} - name: Build and push uses: docker/build-push-action@v5.0.0 with: @@ -776,6 +785,8 @@ jobs: tags: | ${{ steps.prep.outputs.image }}:${{ steps.prep.outputs.tag }} ${{ steps.prep.outputs.image }}:latest + ghcr.io/${{ env.LOWERCASE_REPOSITORY_OWNER }}/v2raya:${{ steps.prep.outputs.tag }} + ghcr.io/${{ env.LOWERCASE_REPOSITORY_OWNER }}/v2raya:latest cache-from: type=gha cache-to: type=gha,mode=max Release_v2rayA_GUI_to_Docker: @@ -805,11 +816,20 @@ jobs: uses: docker/setup-qemu-action@v3.0.0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.0.0 + - name: Login to GitHub container registry + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Login to DockerHub uses: docker/login-action@v3.0.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Convert repository owner to lowercase + run: | + echo "LOWERCASE_REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER@L}" >>${GITHUB_ENV} - name: Build and push uses: docker/build-push-action@v5.0.0 with: @@ -818,7 +838,9 @@ jobs: file: install/docker/Dockerfile.GUI.Action platforms: linux/arm,linux/arm64,linux/amd64 push: true - tags: mzz2017/v2raya-gui:latest + tags: | + mzz2017/v2raya-gui:latest + ghcr.io/${{ env.LOWERCASE_REPOSITORY_OWNER }}/v2raya-gui:latest cache-from: type=gha cache-to: type=gha,mode=max Submit_to_Microsoft_winget: diff --git a/Dockerfile b/Dockerfile index 9bda9440..a15da0d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,7 @@ FROM v2fly/v2fly-core COPY --from=builder /build/service/v2raya /usr/bin/ RUN wget -O /usr/local/share/v2ray/LoyalsoldierSite.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geosite.dat RUN apk add --no-cache iptables ip6tables tzdata +LABEL org.opencontainers.image.source=https://github.com/v2rayA/v2rayA EXPOSE 2017 VOLUME /etc/v2raya ENTRYPOINT ["v2raya"] diff --git a/Dockerfile.gui b/Dockerfile.gui index 1a493969..441e74ed 100644 --- a/Dockerfile.gui +++ b/Dockerfile.gui @@ -5,4 +5,5 @@ RUN yarn && yarn build FROM nginx:stable-alpine COPY --from=builder /web /usr/share/nginx/html +LABEL org.opencontainers.image.source=https://github.com/v2rayA/v2rayA EXPOSE 80 From 2d2c3a53103362fd40929e5d3904da896981a7fa Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Tue, 16 Apr 2024 20:38:52 +0800 Subject: [PATCH 03/16] ci: fix getting friendly filename ci: add version number to filename ci: windows version should be win10 at least chore(docker): Publish docker images on Github Container Registry (#1425) * Temporary test * Push containers to ghcr.io via GitHub Actions * replace tabs with spaces * temporary comment out dockerhub * temporary comment out dockerhub for gui * revertme: remove non-ghcr docker image tags * convert repo owner name to lowercase * fix conversion to lowercase * fix typo, move lowercase conversion to calculate sooner * copy lowercase conversion to both jobs * fix typo * add labels to gui and dev Dockerfiles * specify correct push path for the ghcr.io * fix typo * hardcode image name * specify correct labels for upstream * add dockerhub tags * uncomment dockerhub login * restore Dockerfile.dev --- .github/workflows/release_main.yml | 62 +++++++++++++++++++------ Dockerfile | 1 + Dockerfile.gui | 1 + install/windows-inno/v2rayA-service.xml | 2 +- install/windows-inno/windows_arm64.iss | 1 + install/windows-inno/windows_x86_64.iss | 1 + 6 files changed, 53 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index a2573988..0ba8b441 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -95,44 +95,52 @@ jobs: shell: pwsh run: | New-Item -ItemType Directory -Path v2raya_binaries - foreach ($arch in @('amd64', 'arm64', 'arm', '386', 'riscv64', 'mips64', 'mips64le', 'mipsle', 'mips', 'loong64')) { - Set-Location -Path service + foreach ($arch in @('amd64', 'arm64', '386', 'riscv64', 'mips64', 'mips64le', 'mipsle', 'mips', 'loong64')) { $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-$arch")."friendlyName" - go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath Set-Location -Path .. } foreach ($arm in @('7')) { - Set-Location -Path service $env:GOARCH = 'arm' $env:GOARM = $arm $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-arm$arm")."friendlyName" - go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath Set-Location -Path .. } foreach ($arch in @('amd64', 'arm64')) { $env:GOOS = 'windows' $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."windows-$arch")."friendlyName" - go build -o ../v2raya_binaries/v2raya_$filename.exe -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION}.exe -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. } foreach ($arch in @('amd64', 'arm64')) { $env:GOOS = 'darwin' $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."darwin-$arch")."friendlyName" - go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. } foreach ($arch in @('amd64', 'arm64')) { $env:GOOS = 'freebsd' $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."freebsd-$arch")."friendlyName" - go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. } foreach ($arch in @('amd64', 'arm64')) { $env:GOOS = 'openbsd' $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."openbsd-$arch")."friendlyName" - go build -o ../v2raya_binaries/v2raya_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. } - name: Upload Artifact @@ -186,23 +194,27 @@ jobs: run: | New-Item -ItemType Directory -Path v2raya_binaries foreach ($arch in @('amd64', 'arm64')) { - Set-Location -Path service $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-$arch")."friendlyName" - go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath Set-Location -Path .. } foreach ($arch in @('amd64', 'arm64')) { $env:GOOS = 'windows' $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."windows-$arch")."friendlyName" - go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_$filename.exe -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_${filename}_${env:VERSION}.exe -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. } foreach ($arch in @('amd64', 'arm64')) { $env:GOOS = 'darwin' $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."darwin-$arch")."friendlyName" - go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_$filename -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path service + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. } - name: Upload Artifact uses: nanoufo/action-upload-artifacts-and-release-assets@v2 @@ -808,11 +820,20 @@ jobs: uses: docker/setup-qemu-action@v3.0.0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.0.0 + - name: Login to GitHub container registry + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Login to DockerHub uses: docker/login-action@v3.0.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Convert repository owner to lowercase + run: | + echo "LOWERCASE_REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER@L}" >>${GITHUB_ENV} - name: Build and push uses: docker/build-push-action@v5.0.0 with: @@ -824,6 +845,8 @@ jobs: tags: | ${{ steps.prep.outputs.image }}:${{ steps.prep.outputs.tag }} ${{ steps.prep.outputs.image }}:latest + ghcr.io/${{ env.LOWERCASE_REPOSITORY_OWNER }}/v2raya:${{ steps.prep.outputs.tag }} + ghcr.io/${{ env.LOWERCASE_REPOSITORY_OWNER }}/v2raya:latest cache-from: type=gha cache-to: type=gha,mode=max Release_v2rayA_GUI_to_Docker: @@ -853,11 +876,20 @@ jobs: uses: docker/setup-qemu-action@v3.0.0 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3.0.0 + - name: Login to GitHub container registry + uses: docker/login-action@v3.0.0 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Login to DockerHub uses: docker/login-action@v3.0.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Convert repository owner to lowercase + run: | + echo "LOWERCASE_REPOSITORY_OWNER=${GITHUB_REPOSITORY_OWNER@L}" >>${GITHUB_ENV} - name: Build and push uses: docker/build-push-action@v5.0.0 with: @@ -866,7 +898,9 @@ jobs: file: install/docker/Dockerfile.GUI.Action platforms: linux/arm,linux/arm64,linux/amd64 push: true - tags: mzz2017/v2raya-gui:latest + tags: | + mzz2017/v2raya-gui:latest + ghcr.io/${{ env.LOWERCASE_REPOSITORY_OWNER }}/v2raya-gui:latest cache-from: type=gha cache-to: type=gha,mode=max Submit_to_Microsoft_winget: diff --git a/Dockerfile b/Dockerfile index 9bda9440..a15da0d0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,7 @@ FROM v2fly/v2fly-core COPY --from=builder /build/service/v2raya /usr/bin/ RUN wget -O /usr/local/share/v2ray/LoyalsoldierSite.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geosite.dat RUN apk add --no-cache iptables ip6tables tzdata +LABEL org.opencontainers.image.source=https://github.com/v2rayA/v2rayA EXPOSE 2017 VOLUME /etc/v2raya ENTRYPOINT ["v2raya"] diff --git a/Dockerfile.gui b/Dockerfile.gui index 1a493969..441e74ed 100644 --- a/Dockerfile.gui +++ b/Dockerfile.gui @@ -5,4 +5,5 @@ RUN yarn && yarn build FROM nginx:stable-alpine COPY --from=builder /web /usr/share/nginx/html +LABEL org.opencontainers.image.source=https://github.com/v2rayA/v2rayA EXPOSE 80 diff --git a/install/windows-inno/v2rayA-service.xml b/install/windows-inno/v2rayA-service.xml index d7cfcee1..9df007b9 100644 --- a/install/windows-inno/v2rayA-service.xml +++ b/install/windows-inno/v2rayA-service.xml @@ -25,7 +25,7 @@ SOFTWARE. A web GUI client of Project V which supports VMess, VLESS, SS, SSR, Trojan, Tuic and Juicity protocols. %BASE%\bin\v2raya.exe - --lite --log-file "v2raya.log" --v2ray-assetsdir "%BASE%\data" --config "%BASE%" + --passcheckroot --log-file "v2raya.log" --v2ray-assetsdir "%BASE%\data" --config "%BASE%" %TEMP% diff --git a/install/windows-inno/windows_arm64.iss b/install/windows-inno/windows_arm64.iss index 889be241..7063d14b 100644 --- a/install/windows-inno/windows_arm64.iss +++ b/install/windows-inno/windows_arm64.iss @@ -34,6 +34,7 @@ SolidCompression=yes UninstallDisplayName={#MyAppName}-{#MyAppVersion} WizardStyle=modern SetupIconFile=D:\v2raya.ico +MinVersion=10.0.14393 [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" diff --git a/install/windows-inno/windows_x86_64.iss b/install/windows-inno/windows_x86_64.iss index 20563409..0ab7c796 100644 --- a/install/windows-inno/windows_x86_64.iss +++ b/install/windows-inno/windows_x86_64.iss @@ -34,6 +34,7 @@ SolidCompression=yes UninstallDisplayName={#MyAppName}-{#MyAppVersion} WizardStyle=modern SetupIconFile=D:\v2raya.ico +MinVersion=10.0.14393 [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" From c723b2ee188ead861921d6e8da098f0f098b325f Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Wed, 19 Jun 2024 19:48:03 +0800 Subject: [PATCH 04/16] ci: add test and beta release workflows --- .github/workflows/beta_release_main.yml | 458 ++++++++++++++++++++++++ .github/workflows/pull_request.yml | 6 +- .github/workflows/release_main.yml | 103 ++---- .github/workflows/test_build_main.yml | 202 +++++++++++ 4 files changed, 690 insertions(+), 79 deletions(-) create mode 100644 .github/workflows/beta_release_main.yml create mode 100644 .github/workflows/test_build_main.yml diff --git a/.github/workflows/beta_release_main.yml b/.github/workflows/beta_release_main.yml new file mode 100644 index 00000000..5c72f248 --- /dev/null +++ b/.github/workflows/beta_release_main.yml @@ -0,0 +1,458 @@ +name: Build & Release v2rayA + +on: + workflow_dispatch: + inputs: + tag: + type: string + required: true + +jobs: + Build_v2rayA_Web: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: 'yarn' + cache-dependency-path: gui/yarn.lock + - name: Install Dependencies + run: | + sudo apt-get update -y && sudo apt-get install -y gzip + - name: Build GUI + run: | + yarn --cwd gui --check-files + yarn --cwd gui build + echo "Use tar to generate web.tar.gz..." + tar -zcvf web.tar.gz web/ + - name: Upload Zip File to Artifacts + uses: actions/upload-artifact@v4 + with: + path: web/* + name: web + - name: Upload the tar archive to Artifacts + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 + with: + path: | + web.tar.gz + Build_v2rayA_Binaries: + runs-on: ubuntu-latest + needs: [Build_v2rayA_Web] + env: + CGO_ENABLED: 0 + 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@v4 + with: + fetch-depth: 0 + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: web + path: service/server/router/web + - name: Check Version + id: prep + env: + REF: ${{ inputs.tag }} + run: | + version=${REF} + echo "VERSION=$version" >> $GITHUB_OUTPUT + echo "VERSION=$version" >> $GITHUB_ENV + - name: Set up Go + uses: actions/setup-go@v5 + with: + cache-dependency-path: | + service/go.mod + service/go.sum + go-version: ^1.21 + - name: Build v2rayA Binaries + id: build + shell: pwsh + run: | + New-Item -ItemType Directory -Path v2raya_binaries + foreach ($arch in @('amd64', 'arm64', '386', 'riscv64', 'mips64', 'mips64le', 'mipsle', 'mips', 'loong64')) { + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-$arch")."friendlyName" + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arm in @('7')) { + $env:GOARCH = 'arm' + $env:GOARM = $arm + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-arm$arm")."friendlyName" + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'windows' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."windows-$arch")."friendlyName" + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION}.exe -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'darwin' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."darwin-$arch")."friendlyName" + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'freebsd' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."freebsd-$arch")."friendlyName" + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'openbsd' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."openbsd-$arch")."friendlyName" + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + + - name: Upload Artifact + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 + with: + path: | + v2raya_binaries/* + Build_v2rayA_SingTun_Binaries: + runs-on: ubuntu-latest + needs: [Build_v2rayA_Web] + env: + CGO_ENABLED: 0 + 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@v4 + with: + fetch-depth: 0 + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: web + path: service/server/router/web + - name: Check Version + id: prep + env: + REF: ${{ inputs.tag }} + run: | + version=${REF} + echo "VERSION=$version" >> $GITHUB_OUTPUT + echo "VERSION=$version" >> $GITHUB_ENV + - name: Set up Go + uses: actions/setup-go@v5 + with: + cache-dependency-path: | + service/go.mod + service/go.sum + go-version: ^1.21 + - name: Build v2rayA SingTun Binaries + shell: pwsh + run: | + New-Item -ItemType Directory -Path v2raya_binaries + foreach ($arch in @('amd64', 'arm64')) { + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-$arch")."friendlyName" + Set-Location -Path service + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'windows' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."windows-$arch")."friendlyName" + Set-Location -Path service + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_${filename}_${env:VERSION}.exe -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'darwin' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."darwin-$arch")."friendlyName" + Set-Location -Path service + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + - name: Upload Artifact + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 + with: + path: | + v2raya_binaries/* + Build_Windows_Installers: + runs-on: windows-latest + needs: [Build_v2rayA_SingTun_Binaries] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Check Version + id: prep + shell: bash + env: + REF: ${{ inputs.tag }} + run: | + version=${REF} + echo "VERSION=$version" >> $GITHUB_OUTPUT + echo "VERSION=$version" >> $GITHUB_ENV + - name: Download Artifact Windows x64 + uses: actions/download-artifact@v4 + with: + name: v2raya_with_singtun_windows_x64_${{ steps.prep.outputs.VERSION }}.exe + path: D:\Downloads + - name: Download Artifact Windows arm64 + uses: actions/download-artifact@v4 + with: + name: v2raya_with_singtun_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe + path: D:\Downloads + - name: Install Inno Setup + shell: pwsh + run: | + choco install innosetup -y + - name: Build Windows Installer + shell: pwsh + run: | + ## Create Destination Directory + New-Item -ItemType Directory -Path "D:\v2raya-x86_64-windows\data" + New-Item -ItemType Directory -Path "D:\v2raya-x86_64-windows\bin" + New-Item -ItemType Directory -Path "D:\v2raya-arm64-windows\data" + New-Item -ItemType Directory -Path "D:\v2raya-arm64-windows\bin" + ## Copy v2rayA to Destination Directory + Copy-Item -Path D:\Downloads\v2raya_with_singtun_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-arm64-windows\bin\v2raya.exe + Copy-Item -Path D:\Downloads\v2raya_with_singtun_windows_x64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-x86_64-windows\bin\v2raya.exe + Copy-Item -Path ".\install\windows-inno\v2raya.ico" -Destination "D:\v2raya.ico" + ## Download and extract v2ray + $Url_v2ray_x64 = "https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-windows-64.zip" + $Url_v2ray_A64 = "https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-windows-arm64-v8a.zip" + Invoke-WebRequest $Url_v2ray_x64 -OutFile "D:\v2ray-windows-x64.zip" + Expand-Archive -Path "D:\v2ray-windows-x64.zip" -DestinationPath "D:\v2raya-x86_64-windows\bin\" + Move-Item -Path "D:\v2raya-x86_64-windows\bin\*.dat" -Destination "D:\v2raya-x86_64-windows\data\" + Remove-Item -Path "D:\v2raya-x86_64-windows\bin\*.json" -Force -Recurse -ErrorAction SilentlyContinue + Invoke-WebRequest $Url_v2ray_A64 -OutFile "D:\v2ray-windows-A64.zip" + Expand-Archive -Path "D:\v2ray-windows-A64.zip" -DestinationPath "D:\v2raya-arm64-windows\bin\" + Move-Item -Path "D:\v2raya-arm64-windows\bin\*.dat" -Destination "D:\v2raya-arm64-windows\data\" + Remove-Item -Path "D:\v2raya-arm64-windows\bin\*.json" -Force -Recurse -ErrorAction SilentlyContinue + ## Download WinSW + ## WinSW said they have a native ARM64 version, but I cannot find it, so use net4 version instead on ARM-based Windows. + ## See more in "https://visualstudiomagazine.com/articles/2022/08/12/net-framework-4-8-1.aspx" + $Url_WinSW = "https://github.com/winsw/winsw/releases/download/v3.0.0-alpha.11/WinSW-net461.exe" + Invoke-WebRequest $Url_WinSW -OutFile "D:\WinSW.exe" + Copy-Item -Path "D:\WinSW.exe" -Destination "D:\v2raya-x86_64-windows\v2rayA-service.exe" + Copy-Item -Path "D:\WinSW.exe" -Destination "D:\v2raya-arm64-windows\v2rayA-service.exe" + ## Copy License and Service Config + Copy-Item -Path ".\LICENSE" -Destination "D:\LICENSE.txt" + Copy-Item -Path ".\install\windows-inno\v2rayA-service.xml" -Destination "D:\v2raya-x86_64-windows\v2rayA-service.xml" + Copy-Item -Path ".\install\windows-inno\v2rayA-service.xml" -Destination "D:\v2raya-arm64-windows\v2rayA-service.xml" + ## Set Version + $(Get-Content -Path .\install\windows-inno\windows_x86_64.iss).replace("TheRealVersion", "${{ steps.prep.outputs.VERSION }}") | Out-File "D:\windows_x86_64.iss" + $(Get-Content -Path .\install\windows-inno\windows_arm64.iss).replace("TheRealVersion", "${{ steps.prep.outputs.VERSION }}") | Out-File "D:\windows_arm64.iss" + ## Build Installer + & 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' "D:\windows_x86_64.iss" + & 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' "D:\windows_arm64.iss" + ## Rename to Friendly Name + 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@v2 + with: + path: | + installer_windows_inno_x64_${{ steps.prep.outputs.VERSION }}.exe + installer_windows_inno_arm64_${{ steps.prep.outputs.VERSION }}.exe + Build_Linux_Packages: + runs-on: ubuntu-22.04 + needs: [Build_v2rayA_Binaries] + strategy: + matrix: + goos: [linux] + goarch: [amd64, arm64, 386, riscv64, mips64, mips64le, mipsle, mips, loong64] + include: + - goos: linux + goarch: arm + goarm: 7 + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + GOARM: ${{ matrix.goarm }} + CGO_ENABLED: 0 + 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@v4 + with: + fetch-depth: 0 + - name: Get Friendly File Name + shell: pwsh + id: get_filename + run: | + $build_name = $(((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm }}").friendlyName) + $friendly_arch = $((((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm }}").friendlyName).Split('_')[1]) + Write-Output "BUILD_NAME=$build_name" >> ${env:GITHUB_OUTPUT} + Write-Output "BUILD_NAME=$build_name" >> ${env:GITHUB_ENV} + Write-Output "FRIENDLY_ARCH=$friendly_arch" >> ${env:GITHUB_OUTPUT} + Write-Output "FRIENDLY_ARCH=$friendly_arch" >> ${env:GITHUB_ENV} + - name: Check Version + id: prep + env: + REF: ${{ github.ref }} + run: | + echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT + if [[ "$REF" == "refs/tags/v"* ]]; then + tag=$(git describe --tags $(git rev-list --tags --max-count=1)) + version=${tag:1} + package_version="$(echo "$version" | awk -F 'v' '{print $1}')" + else + date=$(git log -1 --format="%cd" --date=short | sed s/-//g) + count=$(git rev-list --count HEAD) + commit=$(git rev-parse --short HEAD) + version="unstable-$date.r${count}.$commit" + package_version="$date.r${count}.$commit" + fi + echo "VERSION=$version" >> $GITHUB_OUTPUT + echo "VERSION=$version" >> $GITHUB_ENV + echo "PACKAGE_VERSION=$package_version" >> $GITHUB_OUTPUT + echo "PACKAGE_VERSION=$package_version" >> $GITHUB_ENV + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: v2raya_${{ steps.get_filename.outputs.BUILD_NAME }}_${{ steps.prep.outputs.VERSION }} + path: build/ + - name: Download x64 Linux Build + uses: actions/download-artifact@v4 + with: + name: v2raya_linux_x64_${{ steps.prep.outputs.VERSION }} + path: test/ + - name: Show Artifacts + run: | + ls -l build/ + - name: Build Packages + run: | + sudo gem install fpm -v 1.15.1 + sudo apt-get install -y libarchive-tools rpm tar unzip + sudo chmod 755 ./test/v2raya_linux_x64_$VERSION + ./test/v2raya_linux_x64_$VERSION --report config | sed '1,6d' | fold -s -w 78 | sed -E 's/^([^#].+)/# \1/' >> install/universal/v2raya.default + if [ -n "$(echo $GOARCH | grep mips)" ]; then + packages="deb rpm" + else + packages="deb rpm pacman" + fi + sudo chmod 755 ./build/v2raya_${{ steps.get_filename.outputs.BUILD_NAME }}_${{ steps.prep.outputs.VERSION }} + for package_manager in $packages; do + if [ "$package_manager" == 'pacman' ];then + if [ "$GOARCH" == 'arm' ] && [ "$GOARM" == '7' ];then + package_arch='arm7hf' + elif [ "$GOARCH" == 'arm64' ];then + package_arch='aarch64' + else + package_arch="$GOARCH" + fi + elif [ "$package_manager" == 'rpm' ];then + if [ "$GOARCH" == 'arm' ] && [ "$GOARM" == '7' ];then + package_arch='armhfp' + elif [ "$GOARCH" == 'arm64' ];then + package_arch='aarch64' + elif [ "$GOARCH" == 'loong64' ];then + package_arch='loongson64' + else + package_arch="$GOARCH" + fi + elif [ "$package_manager" == 'deb' ];then + if [ "$GOARCH" == 'arm' ] && [ "$GOARM" == '7' ];then + package_arch='armhf' + elif [ "$GOARCH" == '386' ];then + package_arch='i386' + elif [ "$GOARCH" == 'mipsle' ];then + package_arch='mips32le' + else + package_arch="$GOARCH" + fi + fi + fpm -s dir -t "$package_manager" -a $package_arch --version "${{ steps.prep.outputs.PACKAGE_VERSION }}" \ + --url 'https://github.com/v2rayA/v2rayA' --description "$DESC" \ + --maintainer "v2raya@v2raya.org" --name v2raya --license 'AGPL' \ + --package installer_linux_$GOARCH$GOAMD64$GOARM_${{ steps.prep.outputs.VERSION }}.$package_manager \ + --after-install ./install/universal/after_install.sh \ + --after-upgrade ./install/universal/after_upgrade.sh \ + ./build/v2raya_${{ steps.get_filename.outputs.BUILD_NAME }}_${{ steps.prep.outputs.VERSION }}=/usr/bin/v2raya \ + ./install/universal/v2raya.service=/usr/lib/systemd/system/v2raya.service \ + ./install/universal/v2raya-lite.service=/usr/lib/systemd/user/v2raya-lite.service \ + ./install/universal/v2raya.png=/usr/share/icons/hicolor/512x512/apps/v2raya.png \ + ./install/universal/v2raya.desktop=/usr/share/applications/v2raya.desktop \ + ./install/universal/v2raya.default=/etc/default/v2raya + done + mkdir fpm_packages + [ -f installer_linux_$GOARCH$GOAMD64$GOARM_${{ steps.prep.outputs.VERSION }}.pacman ] && \ + mv installer_linux_$GOARCH$GOAMD64$GOARM_${{ steps.prep.outputs.VERSION }}.pacman \ + fpm_packages/installer_archlinux_${{ steps.get_filename.outputs.FRIENDLY_ARCH }}_${{ steps.prep.outputs.VERSION }}.pkg.tar.zst + mv installer_linux_$GOARCH$GOAMD64$GOARM_${{ steps.prep.outputs.VERSION }}.rpm \ + fpm_packages/installer_redhat_${{ steps.get_filename.outputs.FRIENDLY_ARCH }}_${{ steps.prep.outputs.VERSION }}.rpm + 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@v2 + with: + path: | + fpm_packages/* + GitHub_Release: + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-22.04 + needs: [Build_v2rayA_Binaries, Build_Windows_Installers, Build_Linux_Packages, Build_v2rayA_SingTun_Binaries] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Check Version + id: prep + env: + REF: ${{ github.ref }} + shell: bash + run: | + echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT + tag=$(git describe --tags $(git rev-list --tags --max-count=1)) + version=${tag:1} + echo "VERSION=$version" >> $GITHUB_OUTPUT + echo "VERSION=$version" >> $GITHUB_ENV + - name: Download Artifacts + uses: actions/download-artifact@v4 + with: + path: builds/ + - name: Move Files to Release Directory + shell: bash + run: | + mkdir -p release + for file in $(ls builds | grep -E "^installer|^v2raya"); do + mv builds/$file/$file release/ + done + mv builds/web.tar.gz/web.tar.gz release/ + for file in $(ls release); do + sha256sum release/$file | awk '{print $1}' > release/$file.sha256.txt + done + ls -l release/ + - name: Compress Web Files + shell: pwsh + run: | + Compress-Archive -Path ./builds/web/* -DestinationPath ./web.zip + ((Get-FileHash ./web.zip).hash).ToLower() > web.zip.sha256.txt + 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 }}" --generate-notes --prerelease + fi + gh release upload "v${{ steps.prep.outputs.VERSION }}" release/* diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 263a1ee8..52c47f0e 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -15,7 +15,7 @@ jobs: with: fetch-depth: 0 - name: Set up Node.js - uses: actions/setup-node@v4.0.2 + uses: actions/setup-node@v4 with: node-version: lts/* cache: 'yarn' @@ -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@v4.3.1 + uses: actions/upload-artifact@v4 with: path: web/* name: web @@ -46,7 +46,7 @@ jobs: with: fetch-depth: 0 - name: Download Artifact - uses: actions/download-artifact@v4.1.2 + uses: actions/download-artifact@v4 with: name: web path: service/server/router/web diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index 0ba8b441..ff02741c 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -2,20 +2,10 @@ name: Build & Release v2rayA on: workflow_dispatch: - push: - branches: [ main ] - tags: - - v* - paths: - - "**/*.go" - - "go.mod" - - "go.sum" - - "gui/**" - - ".github/workflows/*.yml" - pull_request: - types: [opened, synchronize, reopened] - paths: - - .github/workflows/release_main.yml + inputs: + tag: + type: string + required: true jobs: Build_v2rayA_Web: @@ -25,7 +15,7 @@ jobs: with: fetch-depth: 0 - name: Set up Node.js - uses: actions/setup-node@v4.0.2 + uses: actions/setup-node@v4 with: node-version: lts/* cache: 'yarn' @@ -40,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@v4.3.1 + uses: actions/upload-artifact@v4 with: path: web/* name: web @@ -61,26 +51,16 @@ jobs: with: fetch-depth: 0 - name: Download Artifact - uses: actions/download-artifact@v4.1.2 + uses: actions/download-artifact@v4 with: name: web path: service/server/router/web - name: Check Version id: prep env: - REF: ${{ github.ref }} - shell: bash + REF: ${{ inputs.tag }} run: | - echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT - if [[ "$REF" == "refs/tags/v"* ]]; then - tag=$(git describe --tags $(git rev-list --tags --max-count=1)) - version=${tag:1} - else - date=$(git log -1 --format="%cd" --date=short | sed s/-//g) - count=$(git rev-list --count HEAD) - commit=$(git rev-parse --short HEAD) - version="unstable-$date.r${count}.$commit" - fi + version=${REF} echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Set up Go @@ -160,26 +140,16 @@ jobs: with: fetch-depth: 0 - name: Download Artifact - uses: actions/download-artifact@v4.1.2 + uses: actions/download-artifact@v4 with: name: web path: service/server/router/web - name: Check Version id: prep env: - REF: ${{ github.ref }} - shell: bash + REF: ${{ inputs.tag }} run: | - echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT - if [[ "$REF" == "refs/tags/v"* ]]; then - tag=$(git describe --tags $(git rev-list --tags --max-count=1)) - version=${tag:1} - else - date=$(git log -1 --format="%cd" --date=short | sed s/-//g) - count=$(git rev-list --count HEAD) - commit=$(git rev-parse --short HEAD) - version="unstable-$date.r${count}.$commit" - fi + version=${REF} echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Set up Go @@ -230,29 +200,20 @@ jobs: fetch-depth: 0 - name: Check Version id: prep - env: - REF: ${{ github.ref }} shell: bash + env: + REF: ${{ inputs.tag }} run: | - echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT - if [[ "$REF" == "refs/tags/v"* ]]; then - tag=$(git describe --tags $(git rev-list --tags --max-count=1)) - version=${tag:1} - else - date=$(git log -1 --format="%cd" --date=short | sed s/-//g) - count=$(git rev-list --count HEAD) - commit=$(git rev-parse --short HEAD) - version="unstable-$date.r${count}.$commit" - fi + version=${REF} echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifact Windows x64 - uses: actions/download-artifact@v4.1.2 + uses: actions/download-artifact@v4 with: name: v2raya_with_singtun_windows_x64_${{ steps.prep.outputs.VERSION }}.exe path: D:\Downloads - name: Download Artifact Windows arm64 - uses: actions/download-artifact@v4.1.2 + uses: actions/download-artifact@v4 with: name: v2raya_with_singtun_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe path: D:\Downloads @@ -363,12 +324,12 @@ jobs: echo "PACKAGE_VERSION=$package_version" >> $GITHUB_OUTPUT echo "PACKAGE_VERSION=$package_version" >> $GITHUB_ENV - name: Download Artifact - uses: actions/download-artifact@v4.1.2 + uses: actions/download-artifact@v4 with: name: v2raya_${{ steps.get_filename.outputs.BUILD_NAME }}_${{ steps.prep.outputs.VERSION }} path: build/ - name: Download x64 Linux Build - uses: actions/download-artifact@v4.1.2 + uses: actions/download-artifact@v4 with: name: v2raya_linux_x64_${{ steps.prep.outputs.VERSION }} path: test/ @@ -463,7 +424,7 @@ jobs: echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifacts - uses: actions/download-artifact@v4.1.2 + uses: actions/download-artifact@v4 with: path: builds/ - name: Move Files to Release Directory @@ -679,7 +640,7 @@ jobs: echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifacts - uses: actions/download-artifact@v4.1.2 + uses: actions/download-artifact@v4 with: path: builds/ - name: Prepare Builds @@ -760,17 +721,17 @@ jobs: echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifact Linux x64 - uses: actions/download-artifact@v4.1.2 + uses: actions/download-artifact@v4 with: name: v2raya_linux_x64_${{ steps.prep.outputs.VERSION }} path: Downloads - name: Download Artifact macOS x64 - uses: actions/download-artifact@v4.1.2 + uses: actions/download-artifact@v4 with: name: v2raya_darwin_x64_${{ steps.prep.outputs.VERSION }} path: Downloads - name: Download Artifact macOS arm64 - uses: actions/download-artifact@v4.1.2 + uses: actions/download-artifact@v4 with: name: v2raya_darwin_arm64_${{ steps.prep.outputs.VERSION }} path: Downloads @@ -868,7 +829,7 @@ jobs: IMAGE="mzz2017/v2raya-gui" echo image=${IMAGE} >> $GITHUB_OUTPUT - name: Download Web Files - uses: actions/download-artifact@v4.1.2 + uses: actions/download-artifact@v4 with: name: web path: web @@ -914,19 +875,9 @@ jobs: - name: Check Version id: prep env: - REF: ${{ github.ref }} - shell: bash + REF: ${{ inputs.tag }} run: | - echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT - if [[ "$REF" == "refs/tags/v"* ]]; then - tag=$(git describe --tags $(git rev-list --tags --max-count=1)) - version=${tag:1} - else - date=$(git log -1 --format="%cd" --date=short | sed s/-//g) - count=$(git rev-list --count HEAD) - commit=$(git rev-parse --short HEAD) - version="unstable-$date.r${count}.$commit" - fi + version=${REF} echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Submit to Microsoft winget diff --git a/.github/workflows/test_build_main.yml b/.github/workflows/test_build_main.yml new file mode 100644 index 00000000..08fadb8b --- /dev/null +++ b/.github/workflows/test_build_main.yml @@ -0,0 +1,202 @@ +name: Test Source of v2rayA + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - "**/*.go" + - "go.mod" + - "go.sum" + - "gui/**" + - ".github/workflows/*.yml" + pull_request: + types: [opened, synchronize, reopened] + +jobs: + Build_v2rayA_Web: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: 'yarn' + cache-dependency-path: gui/yarn.lock + - name: Install Dependencies + run: | + sudo apt-get update -y && sudo apt-get install -y gzip + - name: Build GUI + run: | + yarn --cwd gui --check-files + yarn --cwd gui build + echo "Use tar to generate web.tar.gz..." + tar -zcvf web.tar.gz web/ + - name: Upload Zip File to Artifacts + uses: actions/upload-artifact@v4 + with: + path: web/* + name: web + - name: Upload the tar archive to Artifacts + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 + with: + path: | + web.tar.gz + +Build_v2rayA_Binaries: + runs-on: ubuntu-latest + needs: [Build_v2rayA_Web] + env: + CGO_ENABLED: 0 + 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@v4 + with: + fetch-depth: 0 + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: web + path: service/server/router/web + - name: Check Version + id: prep + env: + REF: ${{ inputs.tag }} + run: | + version=${REF} + echo "VERSION=$version" >> $GITHUB_OUTPUT + echo "VERSION=$version" >> $GITHUB_ENV + - name: Set up Go + uses: actions/setup-go@v5 + with: + cache-dependency-path: | + service/go.mod + service/go.sum + go-version: ^1.21 + - name: Build v2rayA Binaries + id: build + shell: pwsh + run: | + New-Item -ItemType Directory -Path v2raya_binaries + foreach ($arch in @('amd64', 'arm64', '386', 'riscv64', 'mips64', 'mips64le', 'mipsle', 'mips', 'loong64')) { + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-$arch")."friendlyName" + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arm in @('7')) { + $env:GOARCH = 'arm' + $env:GOARM = $arm + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-arm$arm")."friendlyName" + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'windows' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."windows-$arch")."friendlyName" + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION}.exe -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'darwin' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."darwin-$arch")."friendlyName" + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'freebsd' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."freebsd-$arch")."friendlyName" + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'openbsd' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."openbsd-$arch")."friendlyName" + Set-Location -Path service + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + + - name: Upload Artifact + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 + with: + path: | + v2raya_binaries/* + + Build_v2rayA_SingTun_Binaries: + runs-on: ubuntu-latest + needs: [Build_v2rayA_Web] + env: + CGO_ENABLED: 0 + 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@v4 + with: + fetch-depth: 0 + - name: Download Artifact + uses: actions/download-artifact@v4 + with: + name: web + path: service/server/router/web + - name: Check Version + id: prep + env: + REF: ${{ inputs.tag }} + run: | + version=${REF} + echo "VERSION=$version" >> $GITHUB_OUTPUT + echo "VERSION=$version" >> $GITHUB_ENV + - name: Set up Go + uses: actions/setup-go@v5 + with: + cache-dependency-path: | + service/go.mod + service/go.sum + go-version: ^1.21 + - name: Build v2rayA SingTun Binaries + shell: pwsh + run: | + New-Item -ItemType Directory -Path v2raya_binaries + foreach ($arch in @('amd64', 'arm64')) { + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."linux-$arch")."friendlyName" + Set-Location -Path service + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'windows' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."windows-$arch")."friendlyName" + Set-Location -Path service + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_${filename}_${env:VERSION}.exe -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + foreach ($arch in @('amd64', 'arm64')) { + $env:GOOS = 'darwin' + $env:GOARCH = $arch + $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."darwin-$arch")."friendlyName" + Set-Location -Path service + go build -tags "with_gvisor" -o ../v2raya_binaries/v2raya_with_singtun_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + Set-Location -Path .. + } + - name: Upload Artifact + uses: nanoufo/action-upload-artifacts-and-release-assets@v2 + with: + path: | + v2raya_binaries/* \ No newline at end of file From 9a1ba565486a05bbe168dd8447653a08c9b67021 Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Wed, 19 Jun 2024 19:58:09 +0800 Subject: [PATCH 05/16] ci: fix test build ci: don't upload singtun builds --- .github/workflows/beta_release_main.yml | 16 ++++++------ .github/workflows/pull_request.yml | 2 +- .github/workflows/release_main.yml | 34 ++++++++++++------------- .github/workflows/test_build_main.yml | 31 ++++++++++------------ 4 files changed, 39 insertions(+), 44 deletions(-) diff --git a/.github/workflows/beta_release_main.yml b/.github/workflows/beta_release_main.yml index 5c72f248..2ad18f19 100644 --- a/.github/workflows/beta_release_main.yml +++ b/.github/workflows/beta_release_main.yml @@ -210,12 +210,12 @@ jobs: - name: Download Artifact Windows x64 uses: actions/download-artifact@v4 with: - name: v2raya_with_singtun_windows_x64_${{ steps.prep.outputs.VERSION }}.exe + name: v2raya_windows_x64_${{ steps.prep.outputs.VERSION }}.exe path: D:\Downloads - name: Download Artifact Windows arm64 uses: actions/download-artifact@v4 with: - name: v2raya_with_singtun_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe + name: v2raya_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe path: D:\Downloads - name: Install Inno Setup shell: pwsh @@ -230,8 +230,8 @@ jobs: New-Item -ItemType Directory -Path "D:\v2raya-arm64-windows\data" New-Item -ItemType Directory -Path "D:\v2raya-arm64-windows\bin" ## Copy v2rayA to Destination Directory - Copy-Item -Path D:\Downloads\v2raya_with_singtun_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-arm64-windows\bin\v2raya.exe - Copy-Item -Path D:\Downloads\v2raya_with_singtun_windows_x64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-x86_64-windows\bin\v2raya.exe + Copy-Item -Path D:\Downloads\v2raya_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-arm64-windows\bin\v2raya.exe + Copy-Item -Path D:\Downloads\v2raya_windows_x64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-x86_64-windows\bin\v2raya.exe Copy-Item -Path ".\install\windows-inno\v2raya.ico" -Destination "D:\v2raya.ico" ## Download and extract v2ray $Url_v2ray_x64 = "https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-windows-64.zip" @@ -415,11 +415,9 @@ jobs: - name: Check Version id: prep env: - REF: ${{ github.ref }} - shell: bash + REF: ${{ inputs.tag }} run: | - echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT - tag=$(git describe --tags $(git rev-list --tags --max-count=1)) + tag=${{ inputs.tag }} version=${tag:1} echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV @@ -450,6 +448,8 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | + echo "Don't upload SingTun binaries to GitHub Release for they are not stable." + rm -f release/v2raya_with_singtun_* 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 diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 52c47f0e..15f174f2 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -81,4 +81,4 @@ jobs: - name: Upload Zip File to Artifacts uses: nanoufo/action-upload-artifacts-and-release-assets@v2 with: - path: v2raya_bin/* \ No newline at end of file + path: v2raya_bin/* diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index ff02741c..6b7fea94 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -60,7 +60,8 @@ jobs: env: REF: ${{ inputs.tag }} run: | - version=${REF} + tag=${{ inputs.tag }} + version=${tag:1} echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Set up Go @@ -149,7 +150,8 @@ jobs: env: REF: ${{ inputs.tag }} run: | - version=${REF} + tag=${{ inputs.tag }} + version=${tag:1} echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Set up Go @@ -193,7 +195,7 @@ jobs: v2raya_binaries/* Build_Windows_Installers: runs-on: windows-latest - needs: [Build_v2rayA_SingTun_Binaries] + needs: [Build_v2rayA_Binaries] steps: - uses: actions/checkout@v4 with: @@ -204,18 +206,18 @@ jobs: env: REF: ${{ inputs.tag }} run: | - version=${REF} + version=${{ inputs.tag }} echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifact Windows x64 uses: actions/download-artifact@v4 with: - name: v2raya_with_singtun_windows_x64_${{ steps.prep.outputs.VERSION }}.exe + name: v2raya_windows_x64_${{ steps.prep.outputs.VERSION }}.exe path: D:\Downloads - name: Download Artifact Windows arm64 uses: actions/download-artifact@v4 with: - name: v2raya_with_singtun_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe + name: v2raya_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe path: D:\Downloads - name: Install Inno Setup shell: pwsh @@ -230,8 +232,8 @@ jobs: New-Item -ItemType Directory -Path "D:\v2raya-arm64-windows\data" New-Item -ItemType Directory -Path "D:\v2raya-arm64-windows\bin" ## Copy v2rayA to Destination Directory - Copy-Item -Path D:\Downloads\v2raya_with_singtun_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-arm64-windows\bin\v2raya.exe - Copy-Item -Path D:\Downloads\v2raya_with_singtun_windows_x64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-x86_64-windows\bin\v2raya.exe + Copy-Item -Path D:\Downloads\v2raya_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-arm64-windows\bin\v2raya.exe + Copy-Item -Path D:\Downloads\v2raya_singtun_windows_x64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-x86_64-windows\bin\v2raya.exe Copy-Item -Path ".\install\windows-inno\v2raya.ico" -Destination "D:\v2raya.ico" ## Download and extract v2ray $Url_v2ray_x64 = "https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-windows-64.zip" @@ -415,11 +417,9 @@ jobs: - name: Check Version id: prep env: - REF: ${{ github.ref }} - shell: bash + REF: ${{ inputs.tag }} run: | - echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT - tag=$(git describe --tags $(git rev-list --tags --max-count=1)) + tag=${{ inputs.tag }} version=${tag:1} echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV @@ -820,14 +820,13 @@ jobs: fetch-depth: 0 - name: Check Version id: prep + env: + REF: ${{ inputs.tag }} run: | - tag=$(git describe --tags $(git rev-list --tags --max-count=1)) + tag=${{ inputs.tag }} version=${tag:1} echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - TAG=$(echo $GITHUB_REF | cut -d / -f 3) - IMAGE="mzz2017/v2raya-gui" - echo image=${IMAGE} >> $GITHUB_OUTPUT - name: Download Web Files uses: actions/download-artifact@v4 with: @@ -877,7 +876,8 @@ jobs: env: REF: ${{ inputs.tag }} run: | - version=${REF} + tag=${{ inputs.tag }} + version=${tag:1} echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Submit to Microsoft winget diff --git a/.github/workflows/test_build_main.yml b/.github/workflows/test_build_main.yml index 08fadb8b..a7c388fb 100644 --- a/.github/workflows/test_build_main.yml +++ b/.github/workflows/test_build_main.yml @@ -1,7 +1,6 @@ name: Test Source of v2rayA on: - workflow_dispatch: push: branches: - main @@ -11,8 +10,6 @@ on: - "go.sum" - "gui/**" - ".github/workflows/*.yml" - pull_request: - types: [opened, synchronize, reopened] jobs: Build_v2rayA_Web: @@ -41,13 +38,8 @@ jobs: with: path: web/* name: web - - name: Upload the tar archive to Artifacts - uses: nanoufo/action-upload-artifacts-and-release-assets@v2 - with: - path: | - web.tar.gz -Build_v2rayA_Binaries: + Build_v2rayA_Binaries: runs-on: ubuntu-latest needs: [Build_v2rayA_Web] env: @@ -65,10 +57,12 @@ Build_v2rayA_Binaries: path: service/server/router/web - name: Check Version id: prep - env: - REF: ${{ inputs.tag }} run: | - version=${REF} + echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT + date=$(git log -1 --format="%cd" --date=short | sed s/-//g) + count=$(git rev-list --count HEAD) + commit=$(git rev-parse --short HEAD) + version="unstable-$date.r${count}.$commit" echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Set up Go @@ -130,13 +124,12 @@ Build_v2rayA_Binaries: go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath Set-Location -Path .. } - - name: Upload Artifact uses: nanoufo/action-upload-artifacts-and-release-assets@v2 with: path: | v2raya_binaries/* - + Build_v2rayA_SingTun_Binaries: runs-on: ubuntu-latest needs: [Build_v2rayA_Web] @@ -155,10 +148,12 @@ Build_v2rayA_Binaries: path: service/server/router/web - name: Check Version id: prep - env: - REF: ${{ inputs.tag }} run: | - version=${REF} + echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT + date=$(git log -1 --format="%cd" --date=short | sed s/-//g) + count=$(git rev-list --count HEAD) + commit=$(git rev-parse --short HEAD) + version="unstable-$date.r${count}.$commit" echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Set up Go @@ -199,4 +194,4 @@ Build_v2rayA_Binaries: uses: nanoufo/action-upload-artifacts-and-release-assets@v2 with: path: | - v2raya_binaries/* \ No newline at end of file + v2raya_binaries/* From 24f55d02bbdb7cfdd1abe041031c7232b61c7000 Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Wed, 19 Jun 2024 20:29:49 +0800 Subject: [PATCH 06/16] ci: don't upload singtun builds --- .github/workflows/beta_release_main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/beta_release_main.yml b/.github/workflows/beta_release_main.yml index 2ad18f19..2c32659e 100644 --- a/.github/workflows/beta_release_main.yml +++ b/.github/workflows/beta_release_main.yml @@ -1,4 +1,4 @@ -name: Build & Release v2rayA +name: Build & Release v2rayA beta on: workflow_dispatch: From 999d737a3085534e44d2ba957e4a63a50af6ded7 Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Wed, 19 Jun 2024 20:38:18 +0800 Subject: [PATCH 07/16] ci: fix get version from input tag --- .github/workflows/beta_release_main.yml | 10 +++++----- .github/workflows/release_main.yml | 25 ++++++++++++++----------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/beta_release_main.yml b/.github/workflows/beta_release_main.yml index 2c32659e..bae74b26 100644 --- a/.github/workflows/beta_release_main.yml +++ b/.github/workflows/beta_release_main.yml @@ -60,7 +60,7 @@ jobs: env: REF: ${{ inputs.tag }} run: | - version=${REF} + version=${{ inputs.tag }} echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Set up Go @@ -149,7 +149,7 @@ jobs: env: REF: ${{ inputs.tag }} run: | - version=${REF} + version=${{ inputs.tag }} echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Set up Go @@ -204,7 +204,7 @@ jobs: env: REF: ${{ inputs.tag }} run: | - version=${REF} + version=${{ inputs.tag }} echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifact Windows x64 @@ -310,7 +310,7 @@ jobs: echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT if [[ "$REF" == "refs/tags/v"* ]]; then tag=$(git describe --tags $(git rev-list --tags --max-count=1)) - version=${tag:1} + version=$(echo $tag | sed 's/v//g') package_version="$(echo "$version" | awk -F 'v' '{print $1}')" else date=$(git log -1 --format="%cd" --date=short | sed s/-//g) @@ -418,7 +418,7 @@ jobs: REF: ${{ inputs.tag }} run: | tag=${{ inputs.tag }} - version=${tag:1} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifacts diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index 6b7fea94..d4d8bf0f 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -61,7 +61,7 @@ jobs: REF: ${{ inputs.tag }} run: | tag=${{ inputs.tag }} - version=${tag:1} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Set up Go @@ -151,7 +151,7 @@ jobs: REF: ${{ inputs.tag }} run: | tag=${{ inputs.tag }} - version=${tag:1} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Set up Go @@ -312,7 +312,7 @@ jobs: echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT if [[ "$REF" == "refs/tags/v"* ]]; then tag=$(git describe --tags $(git rev-list --tags --max-count=1)) - version=${tag:1} + version=$(echo $tag | sed 's/v//g') package_version="$(echo "$version" | awk -F 'v' '{print $1}')" else date=$(git log -1 --format="%cd" --date=short | sed s/-//g) @@ -420,7 +420,7 @@ jobs: REF: ${{ inputs.tag }} run: | tag=${{ inputs.tag }} - version=${tag:1} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifacts @@ -450,6 +450,8 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | + echo "Don't upload SingTun binaries to GitHub Release for they are not stable." + rm -f release/v2raya_with_singtun_* 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 @@ -636,7 +638,7 @@ jobs: run: | echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT tag=$(git describe --tags $(git rev-list --tags --max-count=1)) - version=${tag:1} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifacts @@ -714,10 +716,11 @@ jobs: fetch-depth: 0 - name: Check Version id: prep + env: + REF: ${{ inputs.tag }} run: | - echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT - tag=$(git describe --tags $(git rev-list --tags --max-count=1)) - version=${tag:1} + tag=${{ inputs.tag }} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifact Linux x64 @@ -769,7 +772,7 @@ jobs: id: prep run: | tag=$(git describe --tags $(git rev-list --tags --max-count=1)) - version=${tag:1} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV TAG=$(echo $GITHUB_REF | cut -d / -f 3) @@ -824,7 +827,7 @@ jobs: REF: ${{ inputs.tag }} run: | tag=${{ inputs.tag }} - version=${tag:1} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Web Files @@ -877,7 +880,7 @@ jobs: REF: ${{ inputs.tag }} run: | tag=${{ inputs.tag }} - version=${tag:1} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Submit to Microsoft winget From 68b2d58fcdadf28d540daba071fb41e76a157614 Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Wed, 19 Jun 2024 20:42:52 +0800 Subject: [PATCH 08/16] ci: fix beta windows builds --- .github/workflows/beta_release_main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/beta_release_main.yml b/.github/workflows/beta_release_main.yml index bae74b26..739cb960 100644 --- a/.github/workflows/beta_release_main.yml +++ b/.github/workflows/beta_release_main.yml @@ -122,7 +122,6 @@ jobs: go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath Set-Location -Path .. } - - name: Upload Artifact uses: nanoufo/action-upload-artifacts-and-release-assets@v2 with: @@ -193,7 +192,7 @@ jobs: v2raya_binaries/* Build_Windows_Installers: runs-on: windows-latest - needs: [Build_v2rayA_SingTun_Binaries] + needs: [Build_v2rayA_Binaries] steps: - uses: actions/checkout@v4 with: From 0feab15e97c4645831d0acb4a353f0c0ab369e93 Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Wed, 19 Jun 2024 20:54:30 +0800 Subject: [PATCH 09/16] ci: fix linux package builds --- .github/workflows/beta_release_main.yml | 16 +++------------- .github/workflows/release_main.yml | 16 +++------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/.github/workflows/beta_release_main.yml b/.github/workflows/beta_release_main.yml index 739cb960..da64dda9 100644 --- a/.github/workflows/beta_release_main.yml +++ b/.github/workflows/beta_release_main.yml @@ -304,20 +304,10 @@ jobs: - name: Check Version id: prep env: - REF: ${{ github.ref }} + REF: ${{ inputs.tag }} run: | - echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT - if [[ "$REF" == "refs/tags/v"* ]]; then - tag=$(git describe --tags $(git rev-list --tags --max-count=1)) - version=$(echo $tag | sed 's/v//g') - package_version="$(echo "$version" | awk -F 'v' '{print $1}')" - else - date=$(git log -1 --format="%cd" --date=short | sed s/-//g) - count=$(git rev-list --count HEAD) - commit=$(git rev-parse --short HEAD) - version="unstable-$date.r${count}.$commit" - package_version="$date.r${count}.$commit" - fi + tag=${{ inputs.tag }} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV echo "PACKAGE_VERSION=$package_version" >> $GITHUB_OUTPUT diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index d4d8bf0f..101abb65 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -307,20 +307,10 @@ jobs: - name: Check Version id: prep env: - REF: ${{ github.ref }} + REF: ${{ inputs.tag }} run: | - echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT - if [[ "$REF" == "refs/tags/v"* ]]; then - tag=$(git describe --tags $(git rev-list --tags --max-count=1)) - version=$(echo $tag | sed 's/v//g') - package_version="$(echo "$version" | awk -F 'v' '{print $1}')" - else - date=$(git log -1 --format="%cd" --date=short | sed s/-//g) - count=$(git rev-list --count HEAD) - commit=$(git rev-parse --short HEAD) - version="unstable-$date.r${count}.$commit" - package_version="$date.r${count}.$commit" - fi + tag=${{ inputs.tag }} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV echo "PACKAGE_VERSION=$package_version" >> $GITHUB_OUTPUT From 0cdeb7ad0868ed0704fc6699834816b12ab5608d Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Wed, 19 Jun 2024 21:08:28 +0800 Subject: [PATCH 10/16] ci: beta build's number ci: fix get version from input tag ci: fix linux packages' version --- .github/workflows/beta_release_main.yml | 13 ++++++++----- .github/workflows/release_main.yml | 9 +++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/beta_release_main.yml b/.github/workflows/beta_release_main.yml index da64dda9..a9bb54e2 100644 --- a/.github/workflows/beta_release_main.yml +++ b/.github/workflows/beta_release_main.yml @@ -60,7 +60,8 @@ jobs: env: REF: ${{ inputs.tag }} run: | - version=${{ inputs.tag }} + tag=${{ inputs.tag }} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Set up Go @@ -148,7 +149,8 @@ jobs: env: REF: ${{ inputs.tag }} run: | - version=${{ inputs.tag }} + tag=${{ inputs.tag }} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Set up Go @@ -203,7 +205,8 @@ jobs: env: REF: ${{ inputs.tag }} run: | - version=${{ inputs.tag }} + tag=${{ inputs.tag }} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifact Windows x64 @@ -310,8 +313,8 @@ jobs: version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - echo "PACKAGE_VERSION=$package_version" >> $GITHUB_OUTPUT - echo "PACKAGE_VERSION=$package_version" >> $GITHUB_ENV + echo "PACKAGE_VERSION=$version" >> $GITHUB_OUTPUT + echo "PACKAGE_VERSION=$version" >> $GITHUB_ENV - name: Download Artifact uses: actions/download-artifact@v4 with: diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index 101abb65..9612c858 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -206,7 +206,8 @@ jobs: env: REF: ${{ inputs.tag }} run: | - version=${{ inputs.tag }} + tag=${{ inputs.tag }} + version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - name: Download Artifact Windows x64 @@ -233,7 +234,7 @@ jobs: New-Item -ItemType Directory -Path "D:\v2raya-arm64-windows\bin" ## Copy v2rayA to Destination Directory Copy-Item -Path D:\Downloads\v2raya_windows_arm64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-arm64-windows\bin\v2raya.exe - Copy-Item -Path D:\Downloads\v2raya_singtun_windows_x64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-x86_64-windows\bin\v2raya.exe + Copy-Item -Path D:\Downloads\v2raya_windows_x64_${{ steps.prep.outputs.VERSION }}.exe -Destination D:\v2raya-x86_64-windows\bin\v2raya.exe Copy-Item -Path ".\install\windows-inno\v2raya.ico" -Destination "D:\v2raya.ico" ## Download and extract v2ray $Url_v2ray_x64 = "https://github.com/v2fly/v2ray-core/releases/latest/download/v2ray-windows-64.zip" @@ -313,8 +314,8 @@ jobs: version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV - echo "PACKAGE_VERSION=$package_version" >> $GITHUB_OUTPUT - echo "PACKAGE_VERSION=$package_version" >> $GITHUB_ENV + echo "PACKAGE_VERSION=$version" >> $GITHUB_OUTPUT + echo "PACKAGE_VERSION=$version" >> $GITHUB_ENV - name: Download Artifact uses: actions/download-artifact@v4 with: From 3ff183470890d3c5d69abc837ab106c6e6dadd64 Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Wed, 19 Jun 2024 22:16:46 +0800 Subject: [PATCH 11/16] ci: fix linux packages version --- .github/workflows/beta_release_main.yml | 1 - .github/workflows/release_main.yml | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/beta_release_main.yml b/.github/workflows/beta_release_main.yml index a9bb54e2..0da7cb68 100644 --- a/.github/workflows/beta_release_main.yml +++ b/.github/workflows/beta_release_main.yml @@ -397,7 +397,6 @@ jobs: path: | fpm_packages/* GitHub_Release: - if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-22.04 needs: [Build_v2rayA_Binaries, Build_Windows_Installers, Build_Linux_Packages, Build_v2rayA_SingTun_Binaries] steps: diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index 9612c858..f45346ce 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -398,7 +398,6 @@ jobs: path: | fpm_packages/* GitHub_Release: - if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-22.04 needs: [Build_v2rayA_Binaries, Build_Windows_Installers, Build_Linux_Packages, Build_v2rayA_SingTun_Binaries] steps: @@ -463,7 +462,7 @@ jobs: --data '{"purge_everything":true}' Build_v2ray_Debian_Packages: runs-on: ubuntu-22.04 - if: startsWith(github.ref, 'refs/tags/v') + steps: - name: Install Tools run: | @@ -619,7 +618,7 @@ jobs: Build_APT_Repository_and_AUR: runs-on: ubuntu-22.04 needs: [Build_v2rayA_Binaries, Build_Linux_Packages, Build_v2ray_Debian_Packages] - if: startsWith(github.ref, 'refs/tags/v') + steps: - uses: actions/checkout@v4 with: @@ -700,7 +699,7 @@ jobs: Release_to_Homebrew: runs-on: ubuntu-22.04 needs: [Build_v2rayA_Binaries] - if: startsWith(github.ref, 'refs/tags/v') + steps: - uses: actions/checkout@v4 with: @@ -754,7 +753,7 @@ jobs: Release_v2rayA_to_Docker: runs-on: ubuntu-22.04 needs: [GitHub_Release] - if: startsWith(github.ref, 'refs/tags/v') + steps: - uses: actions/checkout@v4 with: @@ -807,7 +806,7 @@ jobs: Release_v2rayA_GUI_to_Docker: runs-on: ubuntu-22.04 needs: [Build_v2rayA_Web] - if: startsWith(github.ref, 'refs/tags/v') + steps: - uses: actions/checkout@v4 with: @@ -860,7 +859,7 @@ jobs: Submit_to_Microsoft_winget: runs-on: windows-latest needs: [GitHub_Release] - if: startsWith(github.ref, 'refs/tags/v') + steps: - uses: actions/checkout@v4 with: From d82960651a39d7f2abd14870debcb762c5d074b0 Mon Sep 17 00:00:00 2001 From: mzz2017 <2017@duck.com> Date: Wed, 19 Jun 2024 22:19:57 +0800 Subject: [PATCH 12/16] fix: sendthrough problem in tproxy/redirect mode --- service/core/v2ray/v2rayTmpl.go | 9 +++++++-- service/go.mod | 6 +++--- service/go.sum | 19 ++++++------------- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/service/core/v2ray/v2rayTmpl.go b/service/core/v2ray/v2rayTmpl.go index 924b8e28..b9a77653 100644 --- a/service/core/v2ray/v2rayTmpl.go +++ b/service/core/v2ray/v2rayTmpl.go @@ -1640,8 +1640,13 @@ func NewTemplate(serverInfos []serverInfo, setting *configure.Setting) (t *Templ //set inbound listening address and routing t.setDualStack() - //set outbound sendThrough address - t.setSendThrough() + if IsTransparentOn(t.Setting) { + switch t.Setting.TransparentType { + case configure.TransparentGvisorTun, configure.TransparentSystemTun: + //set outbound sendThrough address + t.setSendThrough() + } + } //check if there are any duplicated tags if err = t.checkDuplicatedTags(); err != nil { diff --git a/service/go.mod b/service/go.mod index 301608b5..68d33b0e 100644 --- a/service/go.mod +++ b/service/go.mod @@ -20,9 +20,11 @@ require ( github.com/json-iterator/go v1.1.12 github.com/matoous/go-nanoid v1.5.0 github.com/miekg/dns v1.1.57 + github.com/modern-go/reflect2 v1.0.2 github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 github.com/muhammadmuzzammil1998/jsonc v0.0.0-20201229145248-615b0916ca38 github.com/pkg/errors v0.9.1 + github.com/sagernet/gvisor v0.0.0-20230930141345-5fef6f2e17ab github.com/sagernet/sing v0.2.17 github.com/sagernet/sing-tun v0.1.20 github.com/shadowsocks/go-shadowsocks2 v0.1.5 @@ -37,9 +39,9 @@ require ( github.com/v2rayA/v2ray-lib v0.0.0-20230812093950-85439332d5ce github.com/v2rayA/v2rayA-lib4 v0.0.0-20230812094818-595f87cb2a49 github.com/vearutop/statigz v1.1.7 + go.etcd.io/bbolt v1.3.8 golang.org/x/net v0.18.0 golang.org/x/sys v0.14.0 - go.etcd.io/bbolt v1.3.8 google.golang.org/grpc v1.57.1 google.golang.org/protobuf v1.31.0 ) @@ -71,7 +73,6 @@ require ( github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/mattn/go-isatty v0.0.19 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mzz2017/disk-bloom v1.0.1 // indirect github.com/mzz2017/quic-go v0.0.0-20230902042923-a727c1c479d4 // indirect github.com/onsi/ginkgo/v2 v2.11.0 // indirect @@ -82,7 +83,6 @@ require ( github.com/quic-go/qtls-go1-20 v0.3.3 // indirect github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect github.com/sagernet/go-tun2socks v1.16.12-0.20220818015926-16cb67876a61 // indirect - github.com/sagernet/gvisor v0.0.0-20230930141345-5fef6f2e17ab // indirect github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97 // indirect github.com/scjalliance/comshim v0.0.0-20230315213746-5e51f40bd3b9 // indirect github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect diff --git a/service/go.sum b/service/go.sum index ca6d2e13..855f9971 100644 --- a/service/go.sum +++ b/service/go.sum @@ -67,7 +67,6 @@ github.com/go-chi/render v1.0.2 h1:4ER/udB0+fMWB2Jlf15RV3F4A2FDuYi/9f+lFttR/Lg= github.com/go-chi/render v1.0.2/go.mod h1:/gr3hVkmYR0YlEy3LxCuVRFzEu9Ruok+gFqbIofjao0= github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE= github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78= @@ -202,6 +201,7 @@ github.com/sagernet/gvisor v0.0.0-20230930141345-5fef6f2e17ab h1:u+xQoi/Yc6bNUvT github.com/sagernet/gvisor v0.0.0-20230930141345-5fef6f2e17ab/go.mod h1:3akUhSHSVtLuJaYcW5JPepUraBOW06Ibz2HKwaK5rOk= github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97 h1:iL5gZI3uFp0X6EslacyapiRz7LLSJyr4RajF/BhMVyE= github.com/sagernet/netlink v0.0.0-20220905062125-8043b4a9aa97/go.mod h1:xLnfdiJbSp8rNqYEdIW/6eDO4mVoogml14Bh2hSiFpM= +github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY= github.com/sagernet/sing v0.2.17 h1:vMPKb3MV0Aa5ws4dCJkRI8XEjrsUcDn810czd0FwmzI= github.com/sagernet/sing v0.2.17/go.mod h1:OL6k2F0vHmEzXz2KW19qQzu172FDgSbUSODylighuVo= github.com/sagernet/sing-tun v0.1.20 h1:vYWo/w6fkKc8I1WP/IB8eBWZVsGIC6eoEoNR6XqEDlY= @@ -298,8 +298,6 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA= golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= @@ -313,14 +311,12 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20190116161447-11f53e031339/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -328,6 +324,7 @@ golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190902133755-9109b7679e13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -337,18 +334,16 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210816074244-15123e1e1f71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220731174439-a90be440212d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= @@ -357,8 +352,6 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8= -golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 62c14cc9805d2972e5d1611cdd02436f18fc432b Mon Sep 17 00:00:00 2001 From: mzz2017 <2017@duck.com> Date: Wed, 19 Jun 2024 22:22:57 +0800 Subject: [PATCH 13/16] chore: try to fix yarn engine version problem --- build.sh | 2 +- install/aur/v2raya/PKGBUILD | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index a27f7ec9..805db401 100755 --- a/build.sh +++ b/build.sh @@ -12,5 +12,5 @@ else version="unstable" fi # https://github.com/webpack/webpack/issues/14532#issuecomment-947012063 -cd "$CurrentDir"/gui && yarn && OUTPUT_DIR="$CurrentDir"/service/server/router/web yarn build +cd "$CurrentDir"/gui && yarn --ignore-engines && OUTPUT_DIR="$CurrentDir"/service/server/router/web yarn --ignore-engines build cd "$CurrentDir"/service && CGO_ENABLED=0 go build -tags "with_gvisor" -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CurrentDir"/v2raya \ No newline at end of file diff --git a/install/aur/v2raya/PKGBUILD b/install/aur/v2raya/PKGBUILD index e2ef3a8d..c0c8065c 100644 --- a/install/aur/v2raya/PKGBUILD +++ b/install/aur/v2raya/PKGBUILD @@ -16,8 +16,8 @@ backup=("etc/default/v2raya") build() { cd "$srcdir/v2rayA-$pkgver/gui" - yarn --check-files - OUTPUT_DIR="$srcdir/v2rayA-$pkgver/service/server/router/web" yarn build + yarn --check-files --ignore-engines + OUTPUT_DIR="$srcdir/v2rayA-$pkgver/service/server/router/web" yarn --ignore-engines build cd "$srcdir/v2rayA-$pkgver/service" export GO111MODULE=on From 597b09ad74b4f8ed510b97af3b3d2db9caacf1b4 Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Fri, 21 Jun 2024 19:12:40 +0800 Subject: [PATCH 14/16] fix APT and winget submit --- .github/workflows/release_main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index f45346ce..6d785e7c 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -625,9 +625,10 @@ jobs: fetch-depth: 0 - name: Check Version id: prep + env: + REF: ${{ inputs.tag }} run: | - echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT - tag=$(git describe --tags $(git rev-list --tags --max-count=1)) + tag=${{ inputs.tag }} version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT echo "VERSION=$version" >> $GITHUB_ENV @@ -706,6 +707,7 @@ jobs: fetch-depth: 0 - name: Check Version id: prep + shell: bash env: REF: ${{ inputs.tag }} run: | From e76aba81124ee3a16ee45da846689ad47129c1f6 Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Fri, 21 Jun 2024 19:32:36 +0800 Subject: [PATCH 15/16] ci: fix openbsd builds' double version string --- .github/workflows/beta_release_main.yml | 2 +- .github/workflows/release_main.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/beta_release_main.yml b/.github/workflows/beta_release_main.yml index 0da7cb68..ef7a2cd8 100644 --- a/.github/workflows/beta_release_main.yml +++ b/.github/workflows/beta_release_main.yml @@ -120,7 +120,7 @@ jobs: $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."openbsd-$arch")."friendlyName" Set-Location -Path service - go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath Set-Location -Path .. } - name: Upload Artifact diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index 6d785e7c..8ff937a2 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -120,7 +120,7 @@ jobs: $env:GOARCH = $arch $filename = $((Get-Content ./install/friendly-filenames.json | ConvertFrom-Json)."openbsd-$arch")."friendlyName" Set-Location -Path service - go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath + go build -o ../v2raya_binaries/v2raya_${filename}_${env:VERSION} -ldflags="-X github.com/v2rayA/v2rayA/conf.Version=${env:VERSION} -s -w" -trimpath Set-Location -Path .. } From 222ae7c4e5b6a693c2484f3f954d02d65cb620b8 Mon Sep 17 00:00:00 2001 From: Markson Hon Date: Fri, 21 Jun 2024 19:39:34 +0800 Subject: [PATCH 16/16] ci: fix AUR uploading --- .github/workflows/release_main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release_main.yml b/.github/workflows/release_main.yml index 8ff937a2..8c81a928 100644 --- a/.github/workflows/release_main.yml +++ b/.github/workflows/release_main.yml @@ -628,6 +628,7 @@ jobs: env: REF: ${{ inputs.tag }} run: | + echo "P_DIR=$(pwd)" >> $GITHUB_OUTPUT tag=${{ inputs.tag }} version=$(echo $tag | sed 's/v//g') echo "VERSION=$version" >> $GITHUB_OUTPUT