Release v0.2.0

This commit is contained in:
2026-05-20 12:53:24 +08:00
parent 09b68ada48
commit 36f4256515
12 changed files with 443 additions and 122 deletions

View File

@@ -0,0 +1,60 @@
param(
[string]$Configuration = "Release",
[string]$Version = "0.2.0",
[string]$RuntimeIdentifier = "win-x64"
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$publishProfile = "FolderProfile"
$publishDir = Join-Path $repoRoot "bin\$Configuration\net8.0-windows\$RuntimeIdentifier\publish"
$artifactsDir = Join-Path $repoRoot "artifacts"
$zipPath = Join-Path $artifactsDir "omni-notify-v$Version-$RuntimeIdentifier.zip"
Set-Location $repoRoot
function Invoke-DotNet {
param([string[]]$Arguments)
& dotnet @Arguments
if ($LASTEXITCODE -ne 0) {
throw "dotnet $($Arguments -join ' ') failed with exit code $LASTEXITCODE"
}
}
Invoke-DotNet @("restore", ".\OmniNotify.csproj")
Invoke-DotNet @("clean", ".\OmniNotify.csproj", "-c", $Configuration)
Invoke-DotNet @(
"publish",
".\OmniNotify.csproj",
"-c",
$Configuration,
"-r",
$RuntimeIdentifier,
"--self-contained",
"false",
"-p:PublishProfile=$publishProfile",
"-p:Version=$Version"
)
$runtimeFiles = @("coreclr.dll", "clrjit.dll", "hostfxr.dll", "hostpolicy.dll")
$bundledRuntime = Get-ChildItem -Path $publishDir -Recurse -File |
Where-Object { $runtimeFiles -contains $_.Name }
if ($bundledRuntime) {
$names = ($bundledRuntime | Select-Object -ExpandProperty Name) -join ", "
throw "Publish output appears to include .NET runtime files: $names"
}
if (!(Test-Path $artifactsDir)) {
New-Item -ItemType Directory -Path $artifactsDir | Out-Null
}
if (Test-Path $zipPath) {
Remove-Item $zipPath
}
Compress-Archive -Path (Join-Path $publishDir "*") -DestinationPath $zipPath -CompressionLevel Optimal
Write-Host "Created $zipPath"