Modify the build windows script

pull/6356/head
2dust 2024-12-25 17:06:03 +08:00
parent 7375e1a490
commit eafa20032b
3 changed files with 39 additions and 83 deletions

39
.github/workflows/build-windows.yml vendored Normal file
View File

@ -0,0 +1,39 @@
name: release Windows
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
OutputPath='./bin/v2rayN'
OutputPath64="${OutputPath}/win-x64"
OutputPathArm64="${OutputPath}/win-arm64"
dotnet publish ./v2rayN/v2rayN.csproj -c Release -r win-x64 --self-contained false -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:EnableWindowsTargeting=true -o $OutputPath64
dotnet publish ./v2rayN/v2rayN.csproj -c Release -r win-arm64 --self-contained false -p:PublishReadyToRun=false -p:PublishSingleFile=true -p:EnableWindowsTargeting=true -o $OutputPathArm64
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: v2rayN-windows
path: |
./v2rayN/bin/v2rayN

View File

@ -1,41 +0,0 @@
name: release Windows
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
strategy:
matrix:
configuration: [Release]
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
run: cd v2rayN &&
./build.ps1
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: v2rayN-windows-64
path: |
./v2rayN/v2rayN-windows-64.zip
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: v2rayN-windows-arm64
path: |
./v2rayN/v2rayN-windows-arm64.zip

View File

@ -1,42 +0,0 @@
param (
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]
$OutputPathWin64 = './bin/v2rayN/win-x64',
$OutputPathWinArm64 = './bin/v2rayN/win-arm64'
)
Write-Host 'Building Windows'
dotnet publish `
./v2rayN/v2rayN.csproj `
-c Release `
-r win-x64 `
--self-contained false `
-p:PublishReadyToRun=false `
-p:PublishSingleFile=true `
-o $OutputPathWin64
dotnet publish `
./v2rayN/v2rayN.csproj `
-c Release `
-r win-arm64 `
--self-contained false `
-p:PublishReadyToRun=false `
-p:PublishSingleFile=true `
-o $OutputPathWinArm64
if ( -Not $? ) {
exit $lastExitCode
}
if ( Test-Path -Path ./bin/v2rayN ) {
rm -Force "$OutputPathWin64/*.pdb"
rm -Force "$OutputPathWinArm64/*.pdb"
}
Write-Host 'Build done'
7z a v2rayN-windows-64.zip $OutputPathWin64
7z a v2rayN-windows-arm64.zip $OutputPathWinArm64
exit 0