Skip to content

Commit

Permalink
update build
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Dec 23, 2024
1 parent 25fddc3 commit 8ee0090
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 47 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .github/workflows/build-osx.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: release macos
name: release macOS

on:
push:
Expand Down
17 changes: 3 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: release
name: release Windows

on:
push:
Expand Down Expand Up @@ -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
18 changes: 18 additions & 0 deletions v2rayN/build-linux.sh
Original file line number Diff line number Diff line change
@@ -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
13 changes: 7 additions & 6 deletions v2rayN/build-osx.sh
Original file line number Diff line number Diff line change
@@ -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
27 changes: 1 addition & 26 deletions v2rayN/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 `
Expand All @@ -28,40 +26,17 @@ 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
}

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

0 comments on commit 8ee0090

Please sign in to comment.