mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-10 20:11:09 -05:00
feat(release): ship self-updating Velopack packages on GitHub Releases
Publish-Windows.ps1 now packs the smoke-tested folder with the pinned vpk CLI (.config/dotnet-tools.json, 1.2.0 to match the Velopack package) into velopack/: Setup.exe, Portable.zip, the full nupkg, releases.win.json and RELEASES, checked for the full package and the portable layout and hashed into OpenNest.vX.Y.Z.velopack.sha256. The release workflow uploads them with the candidate. With no feed URL set, installed copies now check GitHub Releases (full releases only) instead of skipping update checks; a URL in Options still selects a self-hosted feed. Deploy-OpenNest.ps1 uses the pinned vpk. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cc16590881
commit
7fe4de4b6d
12 files changed
+108
-39
No files matched your search
@@ -42,12 +42,10 @@ if ($csprojContent -notmatch '<Version>(?<v>[\d.]+)</Version>') { throw "Could n
|
||||
$Version = $Matches.v
|
||||
Write-Host "Packaging OpenNest v$Version"
|
||||
|
||||
# Ensure the vpk (Velopack) CLI is available
|
||||
if (-not (Get-Command vpk -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "Installing vpk CLI (dotnet tool)..."
|
||||
dotnet tool install -g vpk
|
||||
if ($LASTEXITCODE -ne 0) { throw "dotnet tool install vpk failed" }
|
||||
}
|
||||
# The vpk (Velopack) CLI is pinned in .config/dotnet-tools.json to match the Velopack package
|
||||
Push-Location $RepoRoot
|
||||
try { & dotnet tool restore } finally { Pop-Location }
|
||||
if ($LASTEXITCODE -ne 0) { throw "dotnet tool restore failed" }
|
||||
|
||||
$PublishDir = Join-Path $RepoRoot 'OpenNest\bin\publish-tmp'
|
||||
$ReleasesDir = Join-Path $RepoRoot 'OpenNest\bin\releases'
|
||||
@@ -61,7 +59,8 @@ $helpVersion = & (Join-Path $ScriptDir 'Install-Help.ps1') -Destination (Join-Pa
|
||||
Write-Host "Packaged help $helpVersion"
|
||||
|
||||
Write-Host "Packing Velopack release v$Version..."
|
||||
& vpk pack -u OpenNest -v $Version -p $PublishDir -e OpenNest.exe -o $ReleasesDir
|
||||
Push-Location $RepoRoot
|
||||
try { & dotnet tool run vpk pack -u OpenNest -v $Version -p $PublishDir -e OpenNest.exe -o $ReleasesDir } finally { Pop-Location }
|
||||
if ($LASTEXITCODE -ne 0) { throw "vpk pack failed with exit code $LASTEXITCODE" }
|
||||
|
||||
Write-Host "Pushing release feed to $FeedHost..."
|
||||
|
||||
@@ -114,5 +114,32 @@ try {
|
||||
$hash = (Get-FileHash $zip -Algorithm SHA256).Hash.ToLowerInvariant()
|
||||
"$hash $zipName" | Set-Content "$zip.sha256" -Encoding ascii
|
||||
Write-Host "Verified $zipName ($hash), source $commit"
|
||||
|
||||
# Velopack packages of the same verified folder: Setup.exe and the portable ZIP
|
||||
# self-update from GitHub Releases; the plain ZIP above never does.
|
||||
dotnet tool restore
|
||||
if ($LASTEXITCODE -ne 0) { throw 'dotnet tool restore failed.' }
|
||||
$velopack = Join-Path $output 'velopack'
|
||||
dotnet tool run vpk pack -u OpenNest -v $Version -p $package -e OpenNest.exe -o $velopack --packTitle OpenNest
|
||||
if ($LASTEXITCODE -ne 0) { throw 'vpk pack failed.' }
|
||||
|
||||
$assets = @('OpenNest-win-Setup.exe', 'OpenNest-win-Portable.zip', "OpenNest-$Version-full.nupkg", 'releases.win.json', 'RELEASES')
|
||||
foreach ($file in $assets) {
|
||||
if (-not (Test-Path (Join-Path $velopack $file) -PathType Leaf)) { throw "Velopack output missing $file" }
|
||||
}
|
||||
$feed = Get-Content (Join-Path $velopack 'releases.win.json') -Raw | ConvertFrom-Json
|
||||
if (@($feed.Assets | Where-Object { $_.Version -eq $Version -and $_.Type -eq 'Full' }).Count -ne 1) {
|
||||
throw "releases.win.json does not list the $Version full package."
|
||||
}
|
||||
$portable = Join-Path $output 'velopack-portable'
|
||||
Expand-Archive -Path (Join-Path $velopack 'OpenNest-win-Portable.zip') -DestinationPath $portable
|
||||
foreach ($file in @('Update.exe') + ($required | ForEach-Object { "current/$_" })) {
|
||||
if (-not (Test-Path (Join-Path $portable $file) -PathType Leaf)) { throw "Portable ZIP missing $file" }
|
||||
}
|
||||
$sums = foreach ($file in $assets) {
|
||||
"$((Get-FileHash (Join-Path $velopack $file) -Algorithm SHA256).Hash.ToLowerInvariant()) $file"
|
||||
}
|
||||
$sums | Set-Content (Join-Path $output "OpenNest.v$Version.velopack.sha256") -Encoding ascii
|
||||
Write-Host "Packed Velopack release $Version"
|
||||
}
|
||||
finally { Pop-Location }
|
||||
Reference in new issue
Block a user