feat(release): mirror releases to GitHub and fall back to it #112
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/102-mirror-releases-github"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Tagged releases now also publish to the GitHub mirror with every archive and
checksums.txt.install.sh,install.ps1and the in-app updater fall back to GitHub when the Forgejo server is unreachable. A manualgithub-releaseworkflow mirrors releases that already exist, such as v0.1.0.This also fixes an existing updater bug: the version-check timeout was cancelling the context the download inherited, so every accepted update failed immediately with
context canceled.Changes
scripts/publish-github-release.sh <tag> <dir>(new): waits up to 5 min for the tag to reach GitHub (github-push.ymlpushes it concurrently), refuses if a release for the tag already exists (drafts included), creates a draft, uploads every file, then un-drafts.release.yml: new "Mirror to GitHub" step after the Forgejo publish, push only. A GitHub failure can't block the Forgejo release.github-release.yml(new,workflow_dispatch, inputtag): downloads an existing Forgejo release's assets and runs the same script.install.sh/install.ps1: lookup, archive and checksums are fetched as one unit from Forgejo (10 s connect timeout). Any failure in that unit re-runs it against GitHub, with a one-line notice. A checksum mismatch or a missing checksum line stays a hard failure, and the archive and checksums always come from the same host. New overrides:LAZYFORGE_GITHUB_API_URL,LAZYFORGE_GITHUB_URL.internal/update:Checker.SourcesreplacesBaseURL.Latesttries Forgejo, then GitHub, on a transport error, timeout (including a stalled body) or 5xx. A 404 or a bad response body does not fall back.Release.Sourcerecords where the release was found, andApplydownloads only from that source. If every source fails, the error names each one.cmd/lazyforge/update.go: wires both sources, and the check context is now its own (4 s, at most 2 s per source), which fixes the cancelled-download bug.Decisions
GH_RELEASE_*names. Forgejo runners presetGITHUB_API_URLto the Forgejo API, which would otherwise send the GitHub token to Forgejo. A test pins this.dist/(six archives since Windows support, plus checksums).Test plan
make check(format, lint, race tests across 14 packages, govulncheck, build, shellcheck 0.11.0,test-install.sh25/25, Windows vet/build): exit 0.internal/update/fallback_test.go: Forgejo down, 503, hanging, or stalling its body → GitHub. 404 or bad JSON → no fallback, GitHub never contacted. Healthy Forgejo → GitHub never contacted. Both failing → the error names both. Checksum mismatch from GitHub → binary untouched.test-install.shcases cover fallback when Forgejo is down, when an archive or checksums file is missing, when the lookup returns no tag, and with a pinned version. Healthy Forgejo, a checksum mismatch and a missing checksum line never contact GitHub. Six publish-script cases run against a fake GitHub API.install.ps1, both workflows, and real api.github.com upload behavior.Follow-ups
Bparsons0904/lazyforge, add it as the Forgejo Actions secretGH_RELEASE_TOKEN, then run thegithub-releaseworkflow with tagv0.1.0. Until the secret exists, the release workflow's mirror step fails. The Forgejo release has already been published by then.Refs #102
🤖 Generated with Claude Code
https://claude.ai/code/session_01WTZrh5vn4LGcjFQzRVp5TY