desktop dev update channel: every push to main builds dev bundles (<next patch>-dev.<UTC>), the VDS signs and publishes dev/latest.json (newest 5); app channel setting stable|dev, background updater at start / 15 min / resume / channel switch, deferred while in use, no downgrade, autostart rewritten on every start, card shows version and channel

This commit is contained in:
CRTkafa 2026-10-23 23:14:08 +08:00
parent 4dff7d9b2e
commit 39b2f73ad7
25 changed files with 732 additions and 47 deletions

View file

@ -380,6 +380,34 @@ candidate on a tag (Jenkins still publishes site/, and `publish` storebound.dev/
4. **Windows code signing (later).** Buy a code-signing certificate, then sign the installer before `add` and pass
`--code-signed`.
## Dev channel (every push to main)
Installs set to **Dev** in Settings > Updates follow `https://storebound.dev/desktop/dev/latest.json`; everything else
stays on the stable channel (`latest.json`, the npm releases).
- **Version.** `bun tools/desktop-dev.ts stamp`: `<next patch>-dev.<UTC yyyymmddHHMMSS of the commit>`, e.g.
`0.8.48-dev.20261023120000` while 0.8.47 is current. semver puts it above 0.8.47 and below 0.8.48, so the next
stable release passes every dev build of it, and later commits sort higher. The stamp refuses a version that is not
above the live dev `latest.json`. `set` writes it into every version copy of the CI workspace only (never committed).
- **CI** (`.forgejo/workflows/ci.yml`). After the release-candidate build, the `linux` and `windows` jobs build the
same commit again with the dev version (AppImage + deb, NSIS), self-test and privacy-scan them (failures never touch
the candidate). The `dev` job attaches them to a Forgejo **draft** `dev-<version>` (no git tag), deletes all but
the newest 5 dev drafts, and waits up to 20 minutes for the VDS to publish it. No macOS dev build: Developer ID
signing needs the Mac's GUI session.
- **VDS.** `tools/vds/storebound-desktop-dev` (root, `/usr/local/sbin`, run every 2 minutes by
`storebound-desktop-dev.timer`) reads the drafts with a read-only Forgejo token (`/root/.storebound-keys/forgejo-read-token`),
takes the newest complete one above the live dev version, checks its SHA256SUMS, signs every file with the updater key
that lives there, writes latest.json and runs `storebound-desktop-publish <version> dev` (a dev version can only go
to the dev channel and the dev channel takes only dev versions). It keeps the newest 5 dev versions in `dl/`.
Logs: `journalctl -u storebound-desktop-dev`.
Install: copy the script to `/usr/local/sbin/` (755), the `.service` and `.timer` to `/etc/systemd/system/`, then
`systemctl daemon-reload && systemctl enable --now storebound-desktop-dev.timer`.
- **App.** The background updater (src-tauri `lib.rs` `auto_update`, pure rules in `updates.rs`) asks the chosen
channel at start, every 15 minutes, after a resume from sleep and right after a channel switch; it installs only a
strictly newer version (no downgrade: a dev install switched back to stable stays until a stable release passes it),
waits while the main window is visible and focused (at most 4 checks in a row), installs quietly on Windows and
restarts. Each step is an `auto-update (...)` line in `host.log`. Autostart at logon is rewritten on every start.
## Hosting on storebound.dev
| URL | served from | how it gets there |