diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml new file mode 100644 index 00000000..b7cad6f3 --- /dev/null +++ b/.github/workflows/build-linux.yml @@ -0,0 +1,32 @@ +name: release Linux + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + strategy: + matrix: + configuration: [Release] + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build + run: cd v2rayN && + ./build-linux.sh + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: v2rayN-linux + path: | + ./v2rayN/v2rayN-linux.zip + + \ No newline at end of file diff --git a/.github/workflows/build-osx.yml b/.github/workflows/build-osx.yml index b626a510..c1a0e5a5 100644 --- a/.github/workflows/build-osx.yml +++ b/.github/workflows/build-osx.yml @@ -1,4 +1,4 @@ -name: release macos +name: release macOS on: push: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7799f154..646fe435 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: release +name: release Windows on: push: @@ -35,18 +35,7 @@ jobs: name: v2rayN-windows-arm64 path: | ./v2rayN/v2rayN-windows-arm64.zip - - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: v2rayN-linux-64 - path: | - ./v2rayN/v2rayN-linux-64.zip - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: v2rayN-linux-arm64 - path: | - ./v2rayN/v2rayN-linux-arm64.zip + + diff --git a/v2rayN/build-linux.sh b/v2rayN/build-linux.sh new file mode 100644 index 00000000..4f5141c3 --- /dev/null +++ b/v2rayN/build-linux.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +echo 'Building Linux' + +OutputPath='./bin/v2rayN' +OutputPath64="${OutputPath}/linux-x64" +OutputPathArm64="${OutputPath}/linux-arm64" + +dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r linux-x64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o $OutputPath64 +dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r linux-arm64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o $OutputPathArm64 + +rm -rf "$OutputPath64/*.pdb" +rm -rf "$OutputPathArm64/*.pdb" + +echo 'Build done' + +7z a v2rayN-linux.zip $OutputPath +exit 0 diff --git a/v2rayN/build-osx.sh b/v2rayN/build-osx.sh index 4ed79598..10945cb0 100755 --- a/v2rayN/build-osx.sh +++ b/v2rayN/build-osx.sh @@ -1,17 +1,18 @@ #!/bin/sh -echo 'Building' +echo 'Building macOS' OutputPath='./bin/v2rayN' +OutputPath64="${OutputPath}/osx-x64" +OutputPathArm64="${OutputPath}/osx-arm64" -dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r osx-x64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o "${OutputPath}/osx-x64" -dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r osx-arm64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o "${OutputPath}/osx-arm64" +dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r osx-x64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o $OutputPath64 +dotnet publish ./v2rayN.Desktop/v2rayN.Desktop.csproj -c Release -r osx-arm64 --self-contained true -p:PublishReadyToRun=false -p:PublishSingleFile=true -o $OutputPathArm64 -rm -rf "$OutputPath/osx-x64/*.pdb" -rm -rf "$OutputPath/osx-arm64/*.pdb" +rm -rf "$OutputPath64/*.pdb" +rm -rf "$OutputPathArm64/*.pdb" echo 'Build done' -ls $OutputPath 7z a v2rayN-osx.zip $OutputPath exit 0 diff --git a/v2rayN/build.ps1 b/v2rayN/build.ps1 index 349de318..9f4e5153 100644 --- a/v2rayN/build.ps1 +++ b/v2rayN/build.ps1 @@ -4,11 +4,9 @@ param ( [string] $OutputPathWin64 = './bin/v2rayN/win-x64', $OutputPathWinArm64 = './bin/v2rayN/win-arm64', - $OutputPathLinux64 = './bin/v2rayN/linux-x64', - $OutputPathLinuxArm64 = './bin/v2rayN/linux-arm64' ) -Write-Host 'Building' +Write-Host 'Building Windows' dotnet publish ` ./v2rayN/v2rayN.csproj ` @@ -28,25 +26,6 @@ dotnet publish ` -p:PublishSingleFile=true ` -o $OutputPathWinArm64 -dotnet publish ` - ./v2rayN.Desktop/v2rayN.Desktop.csproj ` - -c Release ` - -r linux-x64 ` - --self-contained true ` - -p:PublishReadyToRun=false ` - -p:PublishSingleFile=true ` - -o $OutputPathLinux64 - -dotnet publish ` - ./v2rayN.Desktop/v2rayN.Desktop.csproj ` - -c Release ` - -r linux-arm64 ` - --self-contained true ` - -p:PublishReadyToRun=false ` - -p:PublishSingleFile=true ` - -o $OutputPathLinuxArm64 - - if ( -Not $? ) { exit $lastExitCode } @@ -54,14 +33,10 @@ if ( -Not $? ) { if ( Test-Path -Path ./bin/v2rayN ) { rm -Force "$OutputPathWin64/*.pdb" rm -Force "$OutputPathWinArm64/*.pdb" - rm -Force "$OutputPathLinux64/*.pdb" - rm -Force "$OutputPathLinuxArm64/*.pdb" } Write-Host 'Build done' 7z a v2rayN-windows-64.zip $OutputPathWin64 7z a v2rayN-windows-arm64.zip $OutputPathWinArm64 -7z a v2rayN-linux-64.zip $OutputPathLinux64 -7z a v2rayN-linux-arm64.zip $OutputPathLinuxArm64 exit 0 \ No newline at end of file