From 0a6476d428e437b647abf583df0858112b381f9a Mon Sep 17 00:00:00 2001 From: Elijah Date: Sat, 3 Oct 2026 19:50:21 -0700 Subject: [PATCH] Use Forgejo single-commit route and validate release publisher in CI --- docs/releases.md | 2 +- packaging/Build-ServerRelease.ps1 | 1 + packaging/Publish.ps1 | 2 +- tools/Verify-ReleaseAutomation.ps1 | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/releases.md b/docs/releases.md index b74979c..276966f 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -69,7 +69,7 @@ git push origin v1.0.1 Include all intended source changes in the release commit before tagging. The pushed tag is the publication trigger; ordinary commits to `main` run the build and checks without publishing. The version in `Directory.Build.props` must exactly match the tag. For the first release, use `v1.0.0` after pushing this workflow and the finalized source. -The job runs the engine and updater validation suites, builds both packages, renders the Linux settings page under Xvfb, then uploads everything into one draft release. Only after all uploads succeed does it make the release public, so users cannot discover an incomplete update. No local installer build or manual asset attachment is needed. +The job runs the engine, updater and release-publisher validation suites, builds both packages, renders the Linux settings page under Xvfb, then uploads everything into one draft release. Only after all uploads succeed does it make the release public, so users cannot discover an incomplete update. No local installer build or manual asset attachment is needed. Use **Actions → Release AstroFrame → Run workflow** on `main` to verify runner setup without publishing. A manual run on a version tag publishes that version. Existing published releases cannot be overwritten. Interrupted uploads remain draft releases and can resume when matching build files are reused. If a fresh rebuild generates different bytes, the publisher reports the conflicting draft asset; remove the incomplete draft explicitly before rerunning. Do not delete an already published version. diff --git a/packaging/Build-ServerRelease.ps1 b/packaging/Build-ServerRelease.ps1 index efa769f..5842ee8 100644 --- a/packaging/Build-ServerRelease.ps1 +++ b/packaging/Build-ServerRelease.ps1 @@ -12,5 +12,6 @@ if (!$Ref) { throw 'Supply the source ref, for example -Ref refs/tags/v1.0.0 or Write-Output "Validating AstroFrame $version from $Ref" & ./Build.ps1 -Test if ($LASTEXITCODE) { throw 'Release validation failed.' } +& ./tools/Verify-ReleaseAutomation.ps1 & ./packaging/Release.ps1 -Version $version -Platform Both -PublishRoot artifacts/server-release/publish -Output artifacts/server-release/packages Write-Output "Windows and Linux packages ready for AstroFrame $version." diff --git a/packaging/Publish.ps1 b/packaging/Publish.ps1 index f525df9..6c83398 100644 --- a/packaging/Publish.ps1 +++ b/packaging/Publish.ps1 @@ -43,7 +43,7 @@ if ($LASTEXITCODE) { throw 'Cannot identify the release commit.' } $status = @(& git status --porcelain) if ($LASTEXITCODE) { throw 'Cannot check release source status.' } if ($status.Count -gt 0) { throw 'Commit the release source and push it before publishing.' } -Invoke-RestMethod "$api/commits/$commit" -Headers $headers | Out-Null +Invoke-RestMethod "$api/git/commits/$commit" -Headers $headers | Out-Null $tag = "v$Version" $remoteTag = $null try { $remoteTag = Invoke-RestMethod "$api/tags/$tag" -Headers $headers } diff --git a/tools/Verify-ReleaseAutomation.ps1 b/tools/Verify-ReleaseAutomation.ps1 index c06815c..3be0301 100644 --- a/tools/Verify-ReleaseAutomation.ps1 +++ b/tools/Verify-ReleaseAutomation.ps1 @@ -23,7 +23,8 @@ function git { function Invoke-RestMethod { param([string]$Uri, [string]$Method='Get', $Headers, [string]$ContentType, [string]$Body, $Form) $state.Calls++ - if ($Uri -match '/commits/') { return @{ sha=('a'*40) } } + # Forgejo's single-commit route is /git/commits/{sha}; /commits/{sha} is a 404. + if ($Method -eq 'Get' -and $Uri -match '/git/commits/[0-9a-f]{40}$') { return @{ sha=('a'*40) } } if ($Uri -match '/tags/' -and $Uri -notmatch '/releases/tags/') { return @{ commit=@{sha=$state.TagCommit} } } if ($Uri -match '/releases/tags/') { if (!$state.Created) { throw [Microsoft.PowerShell.Commands.HttpResponseException]::new('Not found', [Net.Http.HttpResponseMessage]::new([Net.HttpStatusCode]::NotFound)) }