feat(release): one-command desktop release with Ed25519-signed update metadata

The installer is unsigned, so latest.yml is now signed with an Ed25519 key and the
app verifies the downloaded installer against it before installing.
npm run release -- patch|minor bumps, gates, tags, builds, signs, publishes,
re-verifies the public feed and pushes; --resume continues after a failure.
The retired GitLab registry publisher is removed.
This commit is contained in:
Yun Chan 2026-10-18 07:06:55 +09:00
parent f5ae4c8c04
commit fd9c97b7cc
21 changed files with 986 additions and 144 deletions

View file

@ -116,12 +116,27 @@ Full procedure and templates: [`docs/map/12-update-protocol.md`](./docs/map/12-u
## 6. Update & release system
Desktop auto-update runs `electron-updater` against the **canonical Forgejo feed**
Desktop auto-update runs `electron-updater` against the **Forgejo feed**
`https://git.chanpaca.net/api/packages/yunchan/generic/d3ro-voice/latest`.
The GitLab project 1172 registry is a **legacy mirror** for pre-Forgejo installs;
runtime must never point at it. Full evaluation and 2026 methodology:
The installer is unsigned (no Authenticode yet), so `latest.yml` is signed with an
**Ed25519 key** and the app verifies the downloaded installer against it before
installing (`apps/desktop/src/main/update-signature.ts`). The GitLab registry mirror
was retired in 2026-10. Full evaluation:
[`docs/deployment/update-system-assessment.md`](./docs/deployment/update-system-assessment.md).
**To ship a desktop release, run one command on `main` with a clean tree:**
```bash
npm run release -- patch # fix → 1.9.0 → 1.9.1
npm run release -- minor # feat → 1.9.0 → 1.10.0
npm run release -- --resume # continue after a failed build/publish/push
```
It bumps the version, drafts the CHANGELOG section if missing (write it by hand first
for user-facing notes), runs the gates, commits + tags, builds, signs, publishes,
re-verifies the public feed, then pushes. Existing installs pick it up on their next
check (15 s after launch, then every 4 h).
These files move together and are enforced by `npm run release:metadata:test`:
| Concern | SSOT |
@ -130,8 +145,10 @@ These files move together and are enforced by `npm run release:metadata:test`:
| builder publish URL | `apps/desktop/electron-builder.yml` |
| update policy (channels, min version, force, delta/full, rollout, kill switch) | `release/update-policy.json` |
| policy runtime logic | `apps/desktop/src/main/update-policy.ts` |
| canonical publisher | `scripts/ci/publish-forgejo-release.mjs` |
| legacy mirror publisher | `scripts/ci/publish-gitlab-release.mjs` |
| one-command release | `scripts/ci/release-desktop.mjs` (`npm run release`) |
| installer build | `scripts/ci/build-desktop-installer.mjs` |
| publisher (sign + upload + verify) | `scripts/ci/publish-forgejo-release.mjs` |
| update signing key | `.env` `D3RO_UPDATE_SIGNING_KEY` (private) · `release/desktop-update-public.pem` == `update-signature.ts` |
| version SSOT | `release/product-version.json` |
Rules:
@ -139,8 +156,12 @@ Rules:
- **Tag-only, immutable releases.** Publish runs only on annotated `vX.Y.Z` tags.
Tags are never moved or deleted; a bad release is fixed forward with a higher
patch. Same-version re-release is forbidden by SemVer.
- **Feed contract.** `UPDATE_FEED_URL` == builder `publish.url` == canonical
Forgejo URL. `LEGACY_UPDATE_FEED_URL` must stay the GitLab mirror.
- **Feed contract.** `UPDATE_FEED_URL` == builder `publish.url` == Forgejo URL.
The app verifies against the immutable `<version>/latest.yml` + `.sig`, never the
mutable `latest` alias.
- **Never rotate or lose the update signing key.** Installs that embed its public key
reject releases signed by any other key; the only recovery is a manual reinstall.
Back up `.env`.
- **Version discipline.** SemVer: `feat`=MINOR, `fix`=PATCH, breaking=MAJOR. Run
`npm run version:sync` when syncing surfaces; `npm run version:check` must be clean.
- **Channels.** `latest` (stable), `beta`, `alpha`. Stable clients never receive a
@ -150,15 +171,16 @@ Rules:
full installer instead of a blockmap delta (`fullInstallOnMajorChange`,
`fullInstallVersionGap`). `stagingPercentage` limits rollout; `killSwitch` stops
update checks remotely.
- **Secrets stay fail-closed.** Every publisher needs `FORGEJO_TOKEN`
(`write:package` + `write:repository`). Desktop releases additionally require the
`WIN_CSC_*` Authenticode material; missing signing data must fail the pipeline.
- **Secrets stay fail-closed.** Publishing needs `FORGEJO_TOKEN`
(`write:package` + `write:repository`) and `D3RO_UPDATE_SIGNING_KEY`; a missing or
mismatched signing key fails before any upload. `WIN_CSC_*` Authenticode material is
optional — when present electron-builder also signs the installer.
- **CI is the backup path.** `.forgejo/workflows/release.yml` runs on the pushed tag
with the same build/publish scripts and skips when the feed already has the version
(the normal case after `npm run release`). Sync secrets with `npm run release:secrets`.
Commands: `npm run release:metadata`, `npm run release:metadata:test`,
`npm run release:forgejo:check`, `npm run release:tag -- --dry-run` (then
`npm run release:tag`, then `git push origin vX.Y.Z`). Use `--sign` when GPG is
configured; tags are annotated and immutable. Locally, `npm run release:forgejo:local`
loads `FORGEJO_TOKEN` from `.env` (gitignored); CI reads the secret from its store.
Other commands: `npm run release -- minor --dry-run`, `npm run release:build`,
`npm run release:metadata:test`, `npm run release:forgejo:check`.
---