mirror of
https://github.com/2dust/v2rayN.git
synced 2026-09-28 17:42:09 +03:00
5e6660aeee
* chore(deps): update xunit.v3 to 4.0.0 and drop the VSTest packages xunit.v3 4.0.0 moves from Microsoft.Testing.Platform v1 to v2, and MTP v2 drops the VSTest bridge on the .NET 10 SDK, so anything routed through VSTest now fails before a single test runs. Rather than bridging back to VSTest, the two VSTest-era packages are removed. The test project is already an executable carrying xunit's own in-process runner, so Microsoft.NET.Test.Sdk and xunit.runner.visualstudio have nothing left to contribute, and without them no opt-in file is needed anywhere. No source or test changes are required: every 4.0.0 breaking change is in the extensibility and runner APIs, and the suite uses only [Fact], [Theory] and [InlineData]. * ci: run the tests directly and let versions float on their major test.yml requested the 8.0.x SDK while every project targets net10.0, which an 8.0 SDK cannot build (NETSDK1045), and it invoked dotnet test, which needs the VSTest bridge that MTP v2 has dropped. It now runs the test executable, which needs no adapter and no test SDK. All three setup-dotnet steps ask for 10.x with quality ga, so a new .NET 10 patch or feature band is picked up automatically while previews and release candidates stay out of builds. setup-dotnet and upload-artifact were the only actions pinned to an exact patch; they now track their major tag like the other seven. * chore(deps): update NLog to 6.2.0 A minor release with no API change on the surface this project uses. Verified beyond compilation: Logging.Setup builds its FileTarget, and both SaveLog overloads write through it at runtime with the expected layout.
249 lines
8.5 KiB
YAML
249 lines
8.5 KiB
YAML
name: release Windows x86
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
release_tag:
|
|
required: false
|
|
type: string
|
|
|
|
permissions:
|
|
contents: write
|
|
actions: read
|
|
|
|
jobs:
|
|
package-x86:
|
|
name: build and release windows x86 WPF & Avalonia
|
|
if: inputs.release_tag != ''
|
|
runs-on: windows-latest
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- flavor: wpf
|
|
project: ./v2rayN/v2rayN/v2rayN.csproj
|
|
zip_name: v2rayN-windows-86.zip
|
|
- flavor: desktop
|
|
project: ./v2rayN/v2rayN.Desktop/v2rayN.Desktop.csproj
|
|
zip_name: v2rayN-windows-86-desktop.zip
|
|
|
|
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@v6
|
|
with:
|
|
dotnet-version: '10.x'
|
|
dotnet-quality: 'ga'
|
|
|
|
- name: Publish ${{ matrix.flavor }} win-x86
|
|
shell: pwsh
|
|
run: |
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
dotnet restore "${{ matrix.project }}" -r win-x86
|
|
|
|
dotnet publish "${{ matrix.project }}" `
|
|
-c Release `
|
|
-r win-x86 `
|
|
-p:SelfContained=true `
|
|
-p:EnableWindowsTargeting=true `
|
|
-o "publish/${{ matrix.flavor }}"
|
|
|
|
- name: Publish AmazTool win-x86
|
|
shell: pwsh
|
|
run: |
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
dotnet publish "./v2rayN/AmazTool/AmazTool.csproj" `
|
|
-c Release `
|
|
-r win-x86 `
|
|
-p:SelfContained=true `
|
|
-p:PublishTrimmed=true `
|
|
-p:EnableWindowsTargeting=true `
|
|
-o "publish/${{ matrix.flavor }}"
|
|
|
|
- name: Detect bundled core versions
|
|
id: detect-core
|
|
shell: pwsh
|
|
run: |
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
New-Item -ItemType Directory -Force -Path "tmp/probe" | Out-Null
|
|
|
|
Invoke-WebRequest -Uri "https://github.com/2dust/v2rayN-core-bin/raw/refs/heads/master/v2rayN-windows-64/bin/xray/xray.exe" -OutFile "tmp/probe/xray.exe"
|
|
$xrayOutput = (& "tmp/probe/xray.exe" version) -join "`n"
|
|
Write-Host $xrayOutput
|
|
|
|
$xrayMatch = [regex]::Match($xrayOutput, 'Xray\s+([0-9.]+)')
|
|
if ($xrayMatch.Success) {
|
|
$xrayVer = $xrayMatch.Groups[1].Value
|
|
} else {
|
|
throw "Failed to detect Xray version"
|
|
}
|
|
|
|
Invoke-WebRequest -Uri "https://github.com/2dust/v2rayN-core-bin/raw/refs/heads/master/v2rayN-windows-64/bin/sing_box/sing-box.exe" -OutFile "tmp/probe/sing-box.exe"
|
|
$singOutput = (& "tmp/probe/sing-box.exe" version) -join "`n"
|
|
Write-Host $singOutput
|
|
|
|
$singMatch = [regex]::Match($singOutput, 'sing-box version\s+([0-9.]+)')
|
|
if ($singMatch.Success) {
|
|
$singVer = $singMatch.Groups[1].Value
|
|
} else {
|
|
throw "Failed to detect sing-box version"
|
|
}
|
|
|
|
Write-Host "Bundled Xray version: $xrayVer"
|
|
Write-Host "Bundled sing-box version: $singVer"
|
|
|
|
"xray_version=$xrayVer" >> $env:GITHUB_OUTPUT
|
|
"sing_version=$singVer" >> $env:GITHUB_OUTPUT
|
|
|
|
- name: Download x86 cores and rule assets
|
|
shell: pwsh
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$headers = @{
|
|
Authorization = "Bearer $env:GH_TOKEN"
|
|
Accept = "application/vnd.github+json"
|
|
"X-GitHub-Api-Version" = "2022-11-28"
|
|
}
|
|
|
|
$root = "publish/${{ matrix.flavor }}"
|
|
$bin = Join-Path $root "bin"
|
|
$xrayDir = Join-Path $bin "xray"
|
|
$singDir = Join-Path $bin "sing_box"
|
|
$srssDir = Join-Path $bin "srss"
|
|
|
|
New-Item -ItemType Directory -Force -Path $xrayDir, $singDir, $srssDir | Out-Null
|
|
|
|
$xrayVer = "${{ steps.detect-core.outputs.xray_version }}"
|
|
$singVer = "${{ steps.detect-core.outputs.sing_version }}"
|
|
|
|
$xrayTag = "v$xrayVer"
|
|
$singTag = "v$singVer"
|
|
|
|
$xrayUrl = "https://github.com/autorepobot/Xray/releases/download/$xrayTag/Xray-windows-32.zip"
|
|
$singUrl = "https://github.com/SagerNet/sing-box/releases/download/$singTag/sing-box-$singVer-windows-386.zip"
|
|
|
|
Write-Host "Bundled Xray version: $xrayVer"
|
|
Write-Host "Bundled sing-box version: $singVer"
|
|
Write-Host "Xray: $xrayUrl"
|
|
Write-Host "sing-box: $singUrl"
|
|
|
|
New-Item -ItemType Directory -Force -Path "tmp" | Out-Null
|
|
|
|
Invoke-WebRequest -Uri $xrayUrl -OutFile "tmp/xray.zip"
|
|
Expand-Archive -Force "tmp/xray.zip" "tmp/xray"
|
|
|
|
Get-ChildItem "tmp/xray" -Recurse -Include "*.exe","*.dll" | ForEach-Object {
|
|
Copy-Item $_.FullName (Join-Path $xrayDir $_.Name) -Force
|
|
}
|
|
|
|
Invoke-WebRequest -Uri $singUrl -OutFile "tmp/sing-box.zip"
|
|
Expand-Archive -Force "tmp/sing-box.zip" "tmp/sing-box"
|
|
|
|
$singExe = Get-ChildItem "tmp/sing-box" -Recurse -Filter "sing-box.exe" | Select-Object -First 1
|
|
if (-not $singExe) {
|
|
throw "sing-box.exe not found"
|
|
}
|
|
|
|
Copy-Item $singExe.FullName "$singDir/sing-box.exe" -Force
|
|
|
|
$cronet = Get-ChildItem "tmp/sing-box" -Recurse -Filter "libcronet*.dll" | Select-Object -First 1
|
|
if ($cronet) {
|
|
Copy-Item $cronet.FullName "$singDir/libcronet.dll" -Force
|
|
}
|
|
|
|
Invoke-WebRequest -Uri "https://github.com/Loyalsoldier/V2ray-rules-dat/releases/latest/download/geosite.dat" -OutFile "$bin/geosite.dat"
|
|
Invoke-WebRequest -Uri "https://github.com/Loyalsoldier/V2ray-rules-dat/releases/latest/download/geoip.dat" -OutFile "$bin/geoip.dat"
|
|
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/Loyalsoldier/geoip/release/geoip-only-cn-private.dat" -OutFile "$bin/geoip-only-cn-private.dat"
|
|
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/Loyalsoldier/geoip/release/Country.mmdb" -OutFile "$bin/Country.mmdb"
|
|
Invoke-WebRequest -Uri "https://github.com/MetaCubeX/meta-rules-dat/releases/latest/download/geoip.metadb" -OutFile "$bin/geoip.metadb"
|
|
|
|
$geoipRules = @(
|
|
"geoip-private.srs",
|
|
"geoip-cn.srs",
|
|
"geoip-facebook.srs",
|
|
"geoip-fastly.srs",
|
|
"geoip-google.srs",
|
|
"geoip-netflix.srs",
|
|
"geoip-telegram.srs",
|
|
"geoip-twitter.srs"
|
|
)
|
|
|
|
foreach ($f in $geoipRules) {
|
|
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/2dust/sing-box-rules/refs/heads/rule-set-geoip/$f" -OutFile "$srssDir/$f"
|
|
}
|
|
|
|
$geositeRules = @(
|
|
"geosite-cn.srs",
|
|
"geosite-gfw.srs",
|
|
"geosite-google.srs",
|
|
"geosite-greatfire.srs",
|
|
"geosite-geolocation-cn.srs",
|
|
"geosite-category-ads-all.srs",
|
|
"geosite-private.srs"
|
|
)
|
|
|
|
foreach ($f in $geositeRules) {
|
|
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/2dust/sing-box-rules/refs/heads/rule-set-geosite/$f" -OutFile "$srssDir/$f"
|
|
}
|
|
|
|
- name: Package zip
|
|
shell: pwsh
|
|
run: |
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
Compress-Archive `
|
|
-Path "publish/${{ matrix.flavor }}/*" `
|
|
-DestinationPath "${{ matrix.zip_name }}" `
|
|
-Force
|
|
|
|
- name: Upload zip artifact
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: release-windows-x86-${{ matrix.flavor }}
|
|
path: ${{ matrix.zip_name }}
|
|
if-no-files-found: error
|
|
|
|
release-x86:
|
|
name: sign and upload windows x86
|
|
if: inputs.release_tag != ''
|
|
needs: package-x86
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
flavor: [ wpf, desktop ]
|
|
uses: ./.github/workflows/upload-sign.yml
|
|
with:
|
|
release_tag: ${{ inputs.release_tag }}
|
|
artifact_name: release-windows-x86-${{ matrix.flavor }}
|
|
file_pattern: '*.zip'
|
|
secrets:
|
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|