forked from v2rayA/v2rayA
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Markson Hon
committed
Apr 16, 2024
1 parent
b0e207f
commit e253122
Showing
2 changed files
with
134 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,77 +50,26 @@ 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 | ||
uses: actions/[email protected] | ||
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/[email protected] | ||
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/[email protected] | ||
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/[email protected] | ||
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 | ||
|