mirror of
https://github.com/wwiinnddyy/LanMountainDesktop.git
synced 2026-06-24 18:44:38 +08:00
- Upgrade actions/checkout from v4 to v7 - Upgrade actions/setup-dotnet from v4 to v5 - Upgrade actions/upload-artifact from v4 to v7 - Upgrade actions/download-artifact from v4 to v4 (already compatible) - Upgrade ncipollo/release-action from v1 to v1.21.0 This addresses GitHub's deprecation of Node.js 20 and the upcoming forced migration to Node.js 24 (effective June 2, 2026).
137 lines
4.6 KiB
YAML
137 lines
4.6 KiB
YAML
name: LanDesktopPLONDS Installer Build
|
|
|
|
on:
|
|
push:
|
|
tags-ignore:
|
|
- '*'
|
|
paths:
|
|
- '.github/workflows/installer-build.yml'
|
|
- 'Directory.Packages.props'
|
|
- 'LanDesktopPLONDS.installer/**'
|
|
- 'LanMountainDesktop.Shared.Contracts/**'
|
|
pull_request:
|
|
paths:
|
|
- '.github/workflows/installer-build.yml'
|
|
- 'Directory.Packages.props'
|
|
- 'LanDesktopPLONDS.installer/**'
|
|
- 'LanMountainDesktop.Shared.Contracts/**'
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
DOTNET_VERSION: '10.0.x'
|
|
INSTALLER_PROJECT: LanDesktopPLONDS.installer/LanDesktopPLONDS.installer.csproj
|
|
INSTALLER_RUNTIME: win-x64
|
|
INSTALLER_ARTIFACT_DIR: artifacts/installer-online/win-x64
|
|
DOTNET_gcServer: 1
|
|
|
|
jobs:
|
|
build-installer:
|
|
runs-on: windows-latest
|
|
name: Build_Installer_${{ matrix.configuration }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
configuration: [Debug, Release]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: ${{ env.DOTNET_VERSION }}
|
|
dotnet-quality: preview
|
|
|
|
- name: Restore installer
|
|
run: dotnet restore ${{ env.INSTALLER_PROJECT }}
|
|
|
|
- name: Build installer
|
|
run: dotnet build ${{ env.INSTALLER_PROJECT }} --no-restore -c ${{ matrix.configuration }} -v minimal
|
|
|
|
- name: Publish online installer artifact payload
|
|
if: matrix.configuration == 'Release'
|
|
shell: pwsh
|
|
run: |
|
|
$publishDir = Join-Path $env:GITHUB_WORKSPACE '${{ env.INSTALLER_ARTIFACT_DIR }}'
|
|
$tempDir = Join-Path $env:GITHUB_WORKSPACE 'artifacts/installer-online/tmp'
|
|
if (Test-Path $publishDir) {
|
|
Remove-Item -LiteralPath $publishDir -Recurse -Force
|
|
}
|
|
|
|
New-Item -ItemType Directory -Path $publishDir -Force | Out-Null
|
|
New-Item -ItemType Directory -Path $tempDir -Force | Out-Null
|
|
$env:TEMP = $tempDir
|
|
$env:TMP = $tempDir
|
|
|
|
dotnet restore '${{ env.INSTALLER_PROJECT }}' `
|
|
-r '${{ env.INSTALLER_RUNTIME }}' `
|
|
-p:PublishAot=true
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "Online installer NativeAOT restore failed with exit code $LASTEXITCODE."
|
|
}
|
|
|
|
dotnet publish '${{ env.INSTALLER_PROJECT }}' `
|
|
--no-restore `
|
|
-c '${{ matrix.configuration }}' `
|
|
-r '${{ env.INSTALLER_RUNTIME }}' `
|
|
-p:PublishAot=true `
|
|
-p:UseAppHost=true `
|
|
-p:DebugType=none `
|
|
-p:DebugSymbols=false `
|
|
-p:StripSymbols=true `
|
|
-o $publishDir `
|
|
-v minimal
|
|
|
|
$installerExe = Join-Path $publishDir 'LanDesktopPLONDS.installer.exe'
|
|
if (-not (Test-Path $installerExe)) {
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "Online installer publish failed with exit code $LASTEXITCODE and did not produce $installerExe."
|
|
}
|
|
|
|
throw "Expected online installer executable was not produced: $installerExe"
|
|
}
|
|
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Warning "dotnet publish exited with $LASTEXITCODE after producing the installer artifact."
|
|
}
|
|
|
|
Get-ChildItem -Path $publishDir -Recurse -Filter '*.pdb' |
|
|
Remove-Item -Force
|
|
|
|
$jitFiles = @(
|
|
'coreclr.dll',
|
|
'clrjit.dll',
|
|
'hostfxr.dll',
|
|
'hostpolicy.dll',
|
|
'LanDesktopPLONDS.installer.deps.json',
|
|
'LanDesktopPLONDS.installer.runtimeconfig.json'
|
|
)
|
|
foreach ($file in $jitFiles) {
|
|
if (Test-Path (Join-Path $publishDir $file)) {
|
|
throw "JIT runtime artifact found in NativeAOT output: $file"
|
|
}
|
|
}
|
|
|
|
$unexpectedFiles = Get-ChildItem -Path $publishDir -File |
|
|
Where-Object { $_.Name -ne 'LanDesktopPLONDS.installer.exe' }
|
|
if ($unexpectedFiles) {
|
|
$names = ($unexpectedFiles | Select-Object -ExpandProperty Name) -join ', '
|
|
throw "Unexpected files in single-exe NativeAOT installer artifact: $names"
|
|
}
|
|
|
|
Get-ChildItem -Path $publishDir -File |
|
|
Sort-Object Name |
|
|
Select-Object Name, Length
|
|
|
|
- name: Upload online installer artifact
|
|
if: matrix.configuration == 'Release'
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: LanDesktopPLONDS-online-installer-${{ env.INSTALLER_RUNTIME }}
|
|
path: ${{ env.INSTALLER_ARTIFACT_DIR }}/**
|
|
if-no-files-found: error
|