feat.action工作流重构

This commit is contained in:
lincube
2026-08-11 23:19:35 +08:00
parent b6fde8188d
commit 43b778608a
4 changed files with 66 additions and 26 deletions

View File

@@ -0,0 +1,57 @@
[CmdletBinding()]
param(
[string]$OutputPath,
[string]$Configuration = "Release",
[string]$Version,
[string]$NuGetPackagesPath
)
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
if ([string]::IsNullOrWhiteSpace($OutputPath)) {
$OutputPath = Join-Path $repoRoot "artifacts\nuget"
}
if ([string]::IsNullOrWhiteSpace($NuGetPackagesPath)) {
$NuGetPackagesPath = Join-Path $repoRoot ".nuget\packages"
}
$resolvedOutputPath = [System.IO.Path]::GetFullPath($OutputPath)
New-Item -ItemType Directory -Force -Path $resolvedOutputPath | Out-Null
$resolvedNuGetPackagesPath = [System.IO.Path]::GetFullPath($NuGetPackagesPath)
New-Item -ItemType Directory -Force -Path $resolvedNuGetPackagesPath | Out-Null
$env:NUGET_PACKAGES = $resolvedNuGetPackagesPath
$projects = @(
"core\LanMountainDesktop.Core\LanMountainDesktop.Core.csproj",
"airapp\LanMountainDesktop.AirAppSdk\LanMountainDesktop.AirAppSdk.csproj",
"airapp\LanMountainDesktop.AirAppTemplate\LanMountainDesktop.AirAppTemplate.csproj"
)
$versionArgs = @()
if (-not [string]::IsNullOrWhiteSpace($Version)) {
$versionArgs += "-p:Version=$Version"
}
foreach ($project in $projects) {
$projectPath = Join-Path $repoRoot $project
if (-not (Test-Path -Path $projectPath)) {
throw "Project '$projectPath' was not found."
}
Write-Host "Packing $project..."
$args = @(
"pack",
$projectPath,
"-c", $Configuration,
"-o", $resolvedOutputPath
) + $versionArgs
& dotnet @args
if ($LASTEXITCODE -ne 0) {
throw "dotnet pack failed for '$projectPath' with exit code $LASTEXITCODE."
}
}
Write-Host "AirApp packages generated to '$resolvedOutputPath'."