Skip to content

feat: add a superadmin one-click release action - #908

Open
HugoXK wants to merge 3 commits into
mainfrom
feat/897-one-click-release
Open

HugoXK wants to merge 3 commits into
mainfrom
feat/897-one-click-release

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Written-by: HugoXK
Fixes #897

What changed

  • Add src/lib/releaseDispatch.ts: a live preview of the GitHub release state (main SHA, latest tag, commits/fixes/features/fragments, next version, ci-ok, open release PR, tag/branch existence) and a workflow_dispatch call for the existing daily-release.yml.
  • Add a superadmin-only block to the Admin release card with the preview, blocked reason, typed RELEASE <version> confirmation and a “Create release PR” button.
  • Add POST /admin/release: superadmin + CSRF + recent GitHub re-authentication + destructive rate limit + audit + a fresh preview and idempotency check before dispatch. It never tags, merges or deploys.
  • Add the release config section and .env.example documentation for RELEASE_DISPATCH_TOKEN, RELEASE_DISPATCH_REPO, RELEASE_DISPATCH_WORKFLOW and RELEASE_DISPATCH_REF.
  • Add the route class, docs/architecture.md/docs/deploy.md documents, docs/secrets.md inventory row, changelog fragment and test/releaseDispatch.test.ts.

Why

Production already runs main, which can be ahead of the latest release tag. The owner wants a superadmin one-click action that turns the current main into the next mechanical release without bypassing the existing release PR, ci-ok, review-gate, auto-merge, tag and publish chain.

The current GitHub App has actions: read only, so the server cannot dispatch the workflow with its installation token. v1 uses a dedicated server-side RELEASE_DISPATCH_TOKEN with Actions: write on the Fledge repository only; an empty value disables the action instead of failing the Admin page. The server .env is configured with the existing bot token until a fine-grained repo-scoped token replaces it.

This is the v1 scope: no force/threshold bypass and no version-bump selector. The current backlog already meets the normal 10/5/1 rule, so the button dispatches without force.

Verification

Ran:

  • npm run lint — pass (11 warnings match the baseline)
  • npm run typecheck — pass
  • npm run build — pass
  • npx tsx --test test/releaseDispatch.test.ts — 7/7 pass
  • npx tsx --test test/routeClassSweep.test.ts test/secretsDoc.test.ts test/pages.test.ts — 71/71 pass
  • npm test — 2440 tests, 2438 pass, 2 environment failures (test/gateBaseTree.test.ts, test/nginxCheck.test.ts) that also fail on a clean origin/main worktree; both need tooling absent here.
  • This head: ci-ok, coverage, pr-lint, risk, lint, typecheck, build, test, docker, CodeQL and the route/secrets tests are green. review-gate is red only because T3 still needs the HugoXK-bot PASS at this tip.
    Not run: a real workflow_dispatch against GitHub from this checkout (the credential is server-side and deliberately not available here); the Docker image; a real GitHub API preview from this checkout.

Security notes

  • The dispatch token is server-side only, repo-scoped, never rendered, logged or returned; an empty value disables the action.
  • POST /admin/release requires superadmin, CSRF, recent GitHub re-authentication, the destructive rate-limit class and an audit row.
  • The action only dispatches the existing release workflow. It does not create a tag, merge a PR or deploy/restart a host; the current release gates remain authoritative.
  • The preview is re-read on the POST, so a stale form cannot dispatch a release that is no longer eligible.

Docs

docs/architecture.md, docs/deploy.md, docs/secrets.md and changelog.d/897-one-click-release.added.md.

The Admin page now previews the live release state and can dispatch the existing daily-release workflow after a typed confirmation, recent GitHub re-authentication, CSRF and the destructive rate limit. The action never tags, merges or deploys; the normal release PR, gates, auto-merge, tag and publish chain stay in charge. The dispatch token is server-side and repo-scoped.
@HugoXK HugoXK added the priority:high High priority; claim before normal backlog label Nov 16, 2026
@HugoXK
HugoXK requested a review from HugoXK-bot November 16, 2026 08:19
@HugoXK

HugoXK commented Nov 16, 2026

Copy link
Copy Markdown
Owner Author

Written-by: HugoXK

@HugoXK-bot reviewer queue: this T3 PR is at 95dc5ade5a5bbb936822eab0ab0a4f7e8149428e. All required checks except review-gate are green (ci-ok, coverage, pr-lint, risk, test, build, CodeQL). Please run the gates at this tip and post PASS/INC/REQUEST_CHANGES with the real Ran: commands. Do not decide from the description or an earlier commit.

This is the #897 one-click release action; the server-side token is configured, and this PR is the remaining gate.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority:high High priority; claim before normal backlog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: superadmin one-click release for the current main

1 participant