Release v0.2.0
This commit is contained in:
60
scripts/package-release.ps1
Normal file
60
scripts/package-release.ps1
Normal 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"
|
||||
Reference in New Issue
Block a user