mirror of
https://github.com/2dust/v2rayN.git
synced 2026-07-26 09:52:05 +03:00
96 lines
2.4 KiB
YAML
96 lines
2.4 KiB
YAML
name: build
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
target: # windows linux macos
|
|
required: true
|
|
type: string
|
|
project:
|
|
required: false
|
|
type: string
|
|
default: './v2rayN.Desktop/v2rayN.Desktop.csproj'
|
|
|
|
jobs:
|
|
build:
|
|
name: build x64 arm64
|
|
strategy:
|
|
matrix:
|
|
arch: [ x64, arm64 ]
|
|
runs-on: |-
|
|
${{
|
|
case(
|
|
inputs.target == 'macos', 'macos-latest',
|
|
inputs.target == 'linux', 'ubuntu-24.04',
|
|
inputs.target == 'windows', 'windows-latest',
|
|
'ubuntu-latest'
|
|
)
|
|
}}
|
|
env:
|
|
Output: "${{ github.workspace }}/${{ matrix.arch }}"
|
|
RID: |-
|
|
${{
|
|
case(
|
|
inputs.target == 'macos', format('osx-{0}', matrix.arch),
|
|
inputs.target == 'windows', format('win-{0}', matrix.arch),
|
|
format('{0}-{1}', inputs.target, matrix.arch)
|
|
)
|
|
}}
|
|
Project: ${{ inputs.project }}
|
|
ExtOpt: |-
|
|
${{
|
|
case(
|
|
inputs.target == 'windows', '-p:EnableWindowsTargeting=true',
|
|
''
|
|
)
|
|
}}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
submodules: 'recursive'
|
|
fetch-depth: '0'
|
|
|
|
- name: Purge SDKs
|
|
shell: pwsh
|
|
run: |
|
|
echo "Before:"
|
|
dotnet --list-sdks
|
|
|
|
dotnet --list-sdks | % {
|
|
$_ -match '^\S+\s+\[(.+)\]$' > $null
|
|
$d = Join-Path $Matches[1] $_.Split()[0]
|
|
Write-Host "Removing $d"
|
|
if ($IsWindows) { rm $d -r -fo } else { sudo rm -rf "$d" }
|
|
}
|
|
|
|
echo "After:"
|
|
dotnet --list-sdks 2>$null; $LASTEXITCODE=0
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v5.4.0
|
|
with:
|
|
dotnet-version: '10.0.1xx'
|
|
|
|
- name: Build v2rayN
|
|
shell: bash
|
|
working-directory: ./v2rayN
|
|
run: dotnet publish $Project -c Release -r $RID -p:SelfContained=true $ExtOpt -o $Output
|
|
|
|
- name: Build AmazTool
|
|
shell: bash
|
|
working-directory: ./v2rayN
|
|
run: dotnet publish ./AmazTool/AmazTool.csproj -c Release -r $RID -p:SelfContained=true -p:PublishTrimmed=true $ExtOpt -o $Output
|
|
|
|
- name: Remove Debug Symbols
|
|
shell: bash
|
|
run: |
|
|
find ${{ matrix.arch }} -type f -name '*.pdb' -delete
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v7.0.1
|
|
with:
|
|
name: ${{ matrix.arch }}
|
|
path: ${{ matrix.arch }}
|