Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

release.md

661 lines41.2 KB

1# Release Checklist
2​
3> For maintainers. Using T3 Code? See [docs/user](../user/).
4​
5This document covers the unified release workflow for stable and nightly desktop releases.
6​
7Beta is the product label, not a release channel or version suffix. Release channels
8remain stable and nightly. To ship 0.1.0 Beta, use `channel=stable` and
9`version=0.1.0`. Removing the Beta label later is a branding change independent of
10the version.
11​
12## What the workflow does
13​
14- Workflow: `.github/workflows/release.yml`
15- Triggers:
16 - manual `workflow_dispatch` with `channel=stable`, the normal way to ship stable. Stable
17 and nightly dispatches must select `main`; preview may select any branch. The channel defaults
18 to preview so an omitted selection cannot publish a stable release.
19 - push tag matching `v*.*.*` for a stable release of an explicit commit
20 - scheduled nightly check every 30 minutes
21 - manual `workflow_dispatch` with `channel=nightly`
22 - manual `workflow_dispatch` with `channel=preview`, the maintainers' test train. It exercises the whole release flow (build, sign, notarize, smoke, publish) for a commit that end users must never receive, which is how an unmerged branch or a risky change gets a real release run before it lands. It builds the triggering commit with nightly's versioning under the `preview` prerelease identifier (`0.0.41-preview.<date>.<run>`) and publishes a GitHub prerelease plus the npm packages under the `preview` dist-tag. Preview is not on the schedule, no default npm dist-tag points at it, its desktop builds carry no update feed, and no updater manifest (`latest*.yml`, `nightly*.yml`, blockmaps) is attached, so a stable or nightly install cannot be offered one. The only ways onto it are downloading the release by hand, `npx t3@preview`, `T3CODE_CHANNEL=preview` for the install scripts, or `t3 update --channel preview` from a terminal; each prints a warning, and the CLI asks for confirmation when the running build is not itself a preview. The release itself is named as a maintainer test build and its body is a warning rather than generated notes: a changelog of unmerged branch history is not a changelog, and nightly and stable notes are unaffected because each series resolves its previous tag within its own channel. The hosted web app, AUR, and Discord announcements are skipped. Keep it; it costs nothing when idle.
23- A manual stable release builds the commit of the latest published nightly, not `main` HEAD.
24 Nightly is the release candidate: verify the nightly, then promote it. Merges to `main` keep
25 landing while you verify and never leak into the stable build.
26 - The version defaults to the one the nightly previewed (`0.0.39-nightly.*` ships as `0.0.39`).
27 Pass the `version` input to override it, for example for a minor bump.
28 - The stable tag is created on the nightly's commit when the GitHub Release is published.
29 - Pushing a `vX.Y.Z` tag by hand still works and builds exactly the tagged commit. Use it when
30 the commit to ship is not the latest nightly, such as a cherry-picked fix on a release branch.
31- Runs lint, typecheck, and tests alongside artifact builds. Publishing waits for every check.
32- Reads the shared production T3 Connect relay URL and Clerk client configuration before packaging clients.
33- Builds the platform-independent JS (server bundle, web client, Electron main) once in the `build_bundle` job and hands it to every platform job as the `js-bundle` artifact; the platform jobs only package it, so no runner rebuilds it.
34- Builds six desktop artifacts in parallel for both channels, each as its own job (`desktop_<platform>_<arch>`, one call of `release-desktop.yml`), gated only on the bundle. macOS and Linux targets build on hardware of their own architecture. Both Windows targets build and sign (with jsign) on a Linux runner, which packages faster than Windows runners, and a Windows job of the target's architecture (`windows-2025` or `windows-11-arm`, the `verify_runner`) runs the packaged natives and the CLI archive. The Windows jobs embed the same-arch Linux CLI archive as the WSL runtime and wait for that artifact partway through, not for the whole Linux job:
35 - macOS `arm64` DMG
36 - macOS `x64` DMG
37 - Linux `x64` and `arm64` AppImage and `.deb`, from one electron-builder run. The `.deb` updates in the app through electron-updater, which installs it with `dpkg`.
38 - Windows `x64` and `arm64` NSIS installer
39- Publishes one GitHub Release with all produced files.
40 - Stable tags with a suffix after `X.Y.Z` (for example `1.2.3-alpha.1`) are published as GitHub prereleases.
41 - Only plain stable `X.Y.Z` releases are marked as the repository's latest release.
42 - Nightly runs are always GitHub prereleases and never marked latest.
43 - Automatically generated release notes are pinned to the previous tag in the same channel, so stable compares to the previous stable tag and nightly compares to the previous nightly tag.
44- Includes Electron auto-update metadata (for example `latest*.yml`, `nightly*.yml`, and `*.blockmap`) in release assets.
45- Builds a self-contained CLI archive per platform (`t3-<version>-<platform>-<arch>.tar.gz`, `.zip` on Windows) in the same job as that target's desktop artifact and attaches them to the GitHub Release with a `SHA256SUMS` file, on every channel, for five targets: macOS arm64, Linux x64 and arm64, Windows x64 and arm64. Every archive is smoke-tested on hardware of its own architecture, and every one but the Windows archives is also built and signed there. There is no macOS x64 archive: Node single-executables are unsupported on x64 macOS (the SEA docs list macOS as arm64 only) and the binary segfaults on start; the x64 desktop app is Electron and unaffected.
46 - The archive holds the server as a Node single-executable (`scripts/build-cli-archive.ts`), so unpacking it needs neither Node, npm, nor a compiler. It is the only form in which T3 Code manages a runtime: the desktop's SSH environments, the boot service, `t3 update`, and the install scripts all download and verify this archive against `SHA256SUMS`. The `t3` npm package exists for people who run `npx t3` or `npm install -g t3` themselves, and it downloads this same archive too; nothing in the product installs from npm. The `curl | sh` installers are `scripts/install.sh` and `scripts/install.ps1`; the marketing site copies them into its `public/` at build time (`apps/marketing/scripts/stage-install-scripts.mjs`) and serves them at `t3.codes/install.sh` and `/install.ps1`.
47 - The root `package.json` pins `engines.node` to the exact Node version used by development, CI and standalone executables. Keep it exact: cross-target builds download that version, and native executable builds reject a different host Node version. Runtime changes need a new T3 release version because installed runtimes are cached by that version.
48 - macOS archives are signed with the Developer ID certificate and notarized when the Apple secrets are present (ad hoc otherwise, which still runs from `curl`/`tar` installs). Windows executables use the same Azure Trusted Signing setup as the installer. Every native addon in the macOS archive is signed too, since the hardened runtime refuses unsigned libraries.
49 - Each archive is extracted and executed (`scripts/smoke-cli-archive.ts`) on its build runner, or on the `verify_runner` for Windows.
50- After the GitHub Release is published, publishes the `t3` npm package with OIDC trusted publishing from the same workflow file. It is only a launcher (`scripts/npm-launcher/t3.mjs`): on first run it downloads its exact version's CLI archive from the GitHub Release, verifies it against `SHA256SUMS`, and unpacks it into `<T3 home>/runtime/versions/<version>`, the layout the install scripts and `t3 update` share. The executables are not on npm. They used to be, as `@t3code/t3-<platform>-<arch>` optional dependencies, but npm's publish-time scanning held those 80-250 MB packages back for up to an hour after the launcher was live, and every install in that window got a launcher with no executable. Those packages stay on npm at their old versions and get no new ones. Because the launcher reads from the release, `publish_cli` runs after `release`, never before.
51 - stable releases publish npm dist-tag `latest`
52 - nightly releases publish npm dist-tag `nightly`
53 - preview releases publish npm dist-tag `preview`, which nothing resolves unless asked for by name
54 - one-time setup: package `t3` needs a trusted publisher registered for this workflow file (see below).
55- Builds the hosted web app on Vercel while the desktop jobs run, and makes it live only after a release is published:
56 - stable releases are aliased to the `latest` hosted app channel
57 - nightly releases are aliased to the `nightly` hosted app channel
58- Signing is optional and auto-detected per platform from secrets.
59​
60## Pull request macOS previews
61​
62Labeling a PR `preview:mac` publishes a signed, notarized Apple Silicon DMG with T3 Connect enabled
63to the rolling `desktop-preview` prerelease, and works for fork PRs. The label is a one-shot request
64for the commit it is applied to: the trusted workflow removes it once the build is in hand, and later
65pushes do not build until a maintainer applies it again. Every signed preview is therefore a
66per-commit maintainer decision, which matters because the result carries the Developer ID signature.
67Vouching a contributor lets their labeled commits be signed; it is not a standing grant. The build is
68split so the Developer ID certificate never shares a job with PR code:
69​
70- `.github/workflows/desktop-macos-preview.yml` runs on `pull_request` with no secrets and builds
71 only the JS bundle from the PR (the same `js-bundle` artifact `release.yml` produces).
72- `.github/workflows/desktop-macos-preview-publish.yml` runs on `workflow_run` from `main`. It
73 refuses unless the PR is open, still labeled, its head is the built commit, and the author is a
74 bot, a collaborator, or listed in `.github/VOUCHED.td` (read from the default branch, so a PR cannot vouch
75 for itself). It then packages and signs the bundle through `release-desktop.yml` checked out at
76 `main`, so packaging, native helpers, and the Electron/desktop dependencies come from `main`, not
77 the PR. Only the version and the public T3 Connect identifiers in `.env.example` are read from the
78 PR commit, as data, so the signed app's passkey entitlement matches the bundle. A PR that changes
79 packaging must use the `channel=preview` release train above instead.
80​
81Before handing the bundle to the signing runner, the trusted workflow validates its ZIP entries
82and accepts only regular files under `server/dist` and `desktop/dist-electron`, plus the directory
83entries that lead to those roots. The artifact cannot
84overwrite packaging code or installed dependencies. The bundle is copied into the app, never executed,
85on the signing runner. The
86`pull_request_target` cleanup job in the publish workflow removes the download when the PR closes, or
87when the label is removed by hand before a build consumed it, and never checks out PR code.
88​
89## Required release credentials
90​
91Stable releases require these GitHub Actions secrets in addition to the platform and deployment
92credentials documented below:
93​
94- `RELEASE_APP_ID`
95- `RELEASE_APP_PRIVATE_KEY`
96​
97The finalize job uses them to commit and push aligned package versions to `main` as the Release App.
98GitHub Release publication uses the repository-scoped workflow token so it has a rate-limit quota
99independent from the shared Release App installation.
100​
101## T3 Connect relay deployment
102​
103The relay is a shared control plane versioned separately from client releases. Stable and nightly
104client builds must point at the same relay so users see the same linked environments when switching
105release channels.
106​
107`.github/workflows/deploy-relay.yml` deploys Alchemy stage `prod` on every push to `main`. The
108release workflow reads the relay URL and Clerk client configuration from the existing `production`
109GitHub Actions environment before building desktop, CLI, or hosted web artifacts.
110​
111Required repository variables shared by relay deployments:
112​
113- `CLOUDFLARE_ACCOUNT_ID`
114- `PLANETSCALE_ORGANIZATION`
115- `AXIOM_ORG_ID`
116​
117Required repository secrets shared by relay deployments:
118​
119- `CLOUDFLARE_API_TOKEN`
120- `PLANETSCALE_API_TOKEN_ID`
121- `PLANETSCALE_API_TOKEN`
122- `AXIOM_TOKEN`
123​
124Required `production` environment variables:
125​
126- `RELAY_API_ZONE_NAME`
127- `RELAY_TUNNEL_ZONE_NAME`
128- `CLERK_PUBLISHABLE_KEY`
129- `CLERK_JWT_AUDIENCE`
130- `CLERK_JWT_TEMPLATE`
131- `CLERK_CLI_OAUTH_CLIENT_ID`
132- `APNS_ENVIRONMENT`
133- `APNS_TEAM_ID`
134- `APNS_KEY_ID`
135- `APNS_BUNDLE_ID`
136​
137Optional `production` environment variables:
138​
139- `RELAY_DOMAIN` when overriding the derived `relay.<RELAY_API_ZONE_NAME>` domain
140- `RELAY_TUNNEL_CLEANUP_MODE` with `off`, `dry-run`, or `enabled`. Missing and blank values use
141 `off`.
142- `RELAY_LEGACY_TUNNEL_CLEANUP_MODE` with the same values, for tunnels whose host never registered
143 recovery. Missing and blank values use `off`.
144​
145Required `production` environment secrets:
146​
147- `CLERK_SECRET_KEY`
148- `APNS_PRIVATE_KEY`
149​
150After changing a variable or secret, run the **Deploy T3 Connect relay** workflow manually from
151`main` with **force** unchecked. Alchemy compares the values the Worker reads and redeploys it when
152one changed. Check **force** only to redeploy resources with no detected change: a forced run also
153replaces the Postgres runtime role and its password
154([alchemy-run/alchemy#1832](https://github.com/alchemy-run/alchemy/issues/1832)).
155​
156The account-scoped repository credentials are consumed by Alchemy while provisioning relay stages; they
157are not bound into the relay Worker. The production deployment uses an Axiom personal access token,
158so `AXIOM_ORG_ID` must accompany `AXIOM_TOKEN`. The `prod` stage owns the retained PlanetScale
159database. Local personal stages provision isolated branches from it and are never deployed by CI.
160Production adopts the configured relay API and tunnel DNS zones as retained Cloudflare resources.
161Personal stages reference the production-owned zones.
162​
163Developers deploy personal stages locally rather than through pull-request automation:
164​
165```sh
166vp run --filter t3code-relay deploy -- --stage "$USER" --env-file .env.local
167```
168​
169### Managed tunnel cleanup rollout
170​
171Keep `RELAY_TUNNEL_CLEANUP_MODE=off` for the first production deploy. That deploy applies the
172nullable allocation migration and adds the recovery endpoints. Web and mobile clients need no
173coordinated release. CLI and desktop server builds must reach users before cleanup is enabled,
174because those builds register recovery and replace a deleted tunnel after wake.
175​
1761. Deploy the relay and migration with cleanup `off`.
1772. Release the server build and confirm current hosts register recovery. Older hosts stay marked
178 legacy and are only candidates under the legacy switch below.
1793. Set `dry-run`, run a relay deploy, and read the sweep counters (`scanned`, `wouldDelete`,
180 `skippedLegacy`, `skippedOrphan`, `failed`, `truncated`) across several sweeps. Each sweep records
181 them, and the active `mode`, as `relay.managed_endpoint_reaper.*` attributes on its
182 `relay.managed_endpoint_reaper.sweep` span in Axiom.
1834. Run the disposable-host canary below.
1845. Set `enabled` only after the canary recovers without a server restart.
185​
186The job runs every five minutes with a five-minute grace period for tunnels that lost their
187connector, so a candidate is usually removed five to ten minutes after it goes down. Tunnels that
188never connected wait an hour. One sweep attempts at most 100 deletions, so a backlog takes longer.
189Changing `RELAY_TUNNEL_CLEANUP_MODE`, including turning cleanup off during an incident, needs a relay
190deploy without force. Confirm the new `mode` on the next sweep span.
191​
192To roll back, set cleanup to `off` and run a relay deploy before downgrading any host. Keep the
193recovery endpoints deployed while current server builds are in use. The nullable columns can stay.
194​
195### Legacy tunnel cleanup
196​
197A legacy tunnel belongs to a host that never registered recovery, usually one that went offline
198before the recovery build shipped. `RELAY_LEGACY_TUNNEL_CLEANUP_MODE` deletes these once Cloudflare
199reports them down, or never connected, for more than 7 days. It is independent of
200`RELAY_TUNNEL_CLEANUP_MODE`, and every other check still applies.
201​
202A deleted legacy tunnel keeps its allocation, so its hostname is kept. When the host comes back:
203​
204- On a build with recovery, the connector is rejected and the host requests a replacement tunnel at
205 the same hostname.
206- On an older build with a CLI link, startup provisions a new tunnel.
207- On an older build linked from web or mobile, the host stays offline until T3 Code on that computer
208 is updated.
209​
210Ship the web and mobile builds that show the offline reason before enabling legacy cleanup, so a
211user whose host is affected sees what to do. The relay adds the `tunnel_released_at` allocation
212column in its first deploy with this change; the legacy switch stays `off` until you set it.
213​
2141. Run `vp run --filter t3code-relay tunnels:census` with a read-only Cloudflare token. It counts
215 tunnels in every relay stage. The reaper only sees its own stage's tunnels, so clean up the rest
216 by hand.
2172. Set the legacy mode to `dry-run`, deploy, and read `wouldDeleteLegacy`, `legacyOver30Days`,
218 `totalDown`, and `totalInactive` on the sweep spans for a day. `wouldDeleteLegacy` counts only the
219 tunnels a sweep inspected, at most 500 per status. `totalDown` and `totalInactive` are Cloudflare's
220 counts of this stage's tunnels down for over five minutes and never connected for over an hour.
221 They include ones the reaper skips, so they are an upper bound on the backlog. The share of `wouldDeleteLegacy` in each sweep's `scanned` estimates how
222 much of that total is eligible.
2233. Run the legacy steps of the disposable-host canary below.
2244. Before enabling, confirm the web and mobile builds that show the "update T3 Code on that computer"
225 message are live. Without them, a user whose older host lost its tunnel only sees it as offline.
2265. Set the legacy mode to `enabled`. One sweep deletes at most 100 tunnels, four at a time, and
227 stops starting new deletions after 90 seconds. A backlog of 20,000 takes about 17 hours if each
228 sweep finishes its 100. Watch `deletedLegacy`, `attempted`, `failed`, and `truncated`. An
229 `attempted` well under 100 with `truncated` set means the sweep stopped early: either the time
230 budget ran out or Cloudflare rate-limited a deletion. The counters don't say which; the relay
231 logs a warning with the Cloudflare error for each failed deletion.
232​
233In Axiom, filter the relay traces dataset on `name == "relay.managed_endpoint_reaper.sweep"` and
234chart the `attributes.custom.relay.managed_endpoint_reaper.*` fields over time.
235​
236Set the legacy mode back to `off` and deploy if any of these happen:
237​
238- `failed` stays above a few per sweep. Read the warning log for the Cloudflare error.
239- Users report an environment that is offline with the update message after they have updated T3
240 Code on that computer and restarted it.
241- Relay request errors rise while sweeps run. Deletions share the Postgres connection pool with
242 request handlers.
243​
244Turning the legacy mode off stops new legacy deletions; `RELAY_TUNNEL_CLEANUP_MODE` keeps deleting
245tunnels of hosts with recovery while it is `enabled`. Deleted tunnels stay deleted; their hosts
246recover as described above.
247​
248### Disposable-host canary
249​
250This test has not been run against a real Cloudflare account. Run it against a disposable relay
251stage, test Cloudflare account, disposable host, and disposable T3 home. Keep production cleanup at
252`off` or `dry-run` until it passes. Do not stop a daily-use T3 server.
253​
2541. Deploy the disposable stage with cleanup `dry-run`. Link a first disposable environment through
255 web or mobile settings and confirm its tunnel is healthy and recovery is registered.
2562. Stop that host and restart the same T3 home on a different local port. Confirm the public
257 hostname reaches the new port and sends nothing to the old one.
2583. Link a second disposable environment with a server build that predates recovery registration.
259 Capture its managed `cloudflared` child PID, confirm it belongs to that host, and pause only that
260 child with `kill -STOP <legacy-pid>`. Wait until Cloudflare reports it down for over five minutes.
2614. Capture the first environment's `cloudflared` child PID from its server logs, confirm ownership,
262 and pause it with `kill -STOP <first-pid>`. Wait until Cloudflare reports it down for over five
263 minutes.
2645. Confirm dry-run counts the first tunnel in `wouldDelete` and the second in `skippedLegacy`.
2656. Set cleanup `enabled` on the disposable stage and deploy. Confirm in the test Cloudflare account
266 that the first tunnel is deleted and the legacy tunnel still exists.
2677. Resume the first child with `kill -CONT <first-pid>`. Confirm the running server detects the
268 repeated rejection, requests recovery, and becomes reachable at the same hostname without a
269 restart.
2708. Resume the legacy child with `kill -CONT <legacy-pid>` and confirm its tunnel reconnects.
2719. Repeat with a physical sleep and wake cycle on a disposable laptop before broad rollout.
272​
273Legacy cleanup, on the same disposable stage:
274​
27510. Set `RELAY_LEGACY_TUNNEL_GRACE_MINUTES=10` and the legacy mode to `dry-run`, then deploy. The
276 override shortens the 7-day grace period and is ignored on `prod`. Pause the legacy child again
277 and wait until Cloudflare reports it down for over ten minutes.
27811. Confirm the sweep counts it in `wouldDeleteLegacy`, then set the legacy mode to `enabled` and
279 deploy. Confirm the legacy tunnel is deleted and its allocation row remains.
28012. With the legacy host still on its old build, resume the child. A CLI-linked host provisions a
281 new tunnel on its next restart; a web- or mobile-linked host stays offline.
28213. Update that host to the current build and start it. Confirm it requests recovery and is
283 reachable at the same hostname.
28414. Remove `RELAY_LEGACY_TUNNEL_GRACE_MINUTES` from the disposable stage.
285​
286## Marketing site deployment
287​
288On nightly releases, the release workflow builds the same commit as a staged
289production deployment of the marketing site's Vercel project while the desktop
290jobs run, and promotes it with `vercel promote` after the release is published.
291Stable releases do not deploy the marketing site because they can promote an
292older nightly commit.
293​
294The job looks up the `t3code-marketing` project using the existing `VERCEL_TOKEN`
295and `VERCEL_ORG_ID` secrets. It also respects the optional `VERCEL_TEAM_SLUG`
296variable. The Vercel project's root directory must be `apps/marketing`.
297Git deployments remain disabled in `apps/marketing/vercel.ts`.
298​
299## Mobile TestFlight and store releases
300​
301Merges to main publish compatible OTAs and build iOS prereleases with the `testflight`
302profile at version `3.0.0`. Build numbers increment automatically. The committed app
303version remains the App Store release version; Android keeps using that version.
304​
305To release iOS, dispatch **Mobile EAS Production** with `mode=build`,
306`profile=production`, `platform=ios`, and the intended version, such as `2.0.1`.
307The workflow commits and pushes the version before building and uploading it.
308Select that build in App Store Connect for App Store review.
309​
310To force a TestFlight rebuild, select `profile=testflight`, `platform=ios`, and
311leave the version blank. Submit the first `3.0.0` build for external beta review
312in App Store Connect. Later builds may still require review; uploads alone do
313not guarantee external approval. TestFlight builds expire after 90 days.
314​
315Both release and TestFlight binaries receive compatible production-channel OTAs,
316separated by their major-version fingerprints. Manual `mode=update` uses the
317selected profile's version. Before releasing `3.0.0` to the App Store, advance
318`build.testflight.env.T3CODE_MOBILE_VERSION` in `apps/mobile/eas.json` to the next
319unreleased major and get its first beta build approved.
320​
321## Android APK mirror
322​
323`.github/workflows/mobile-android-apk.yml` checks the Google Play Alpha closed-testing
324track hourly. Each new beta gets one `android-beta-<build-number>` prerelease
325containing its APK. Unchanged checks publish nothing, and interrupted draft
326uploads resume on the next check.
327​
328Normal Nightly releases include the newest processed internal-testing APK available
329when the release publishes. Internal builds do not create separate Android releases.
330If Play credentials or a processed APK are unavailable, the Nightly can still publish
331without an APK. Android submissions continue to go to internal testing; promote a
332build to Alpha to publish it as a beta.
333​
334The APK is the universal APK Play generates and signs from the
335uploaded bundle, so no signing key lives in GitHub. The job skips itself until
336`GOOGLE_PLAY_SERVICE_ACCOUNT_JSON` holds a Play service account key with the "Release to
337production, exclude devices, and use Play App Signing" permission, which downloading generated
338APKs requires. The job reads tracks without opening a Play edit, so it can share the service
339account EAS Submit uses.
340​
341## Hosted web app release deployment
342​
343The hosted app is intentionally not deployed by Vercel's Git integration. The
344web project disables automatic Git deployments in `apps/web/vercel.ts` via
345`git.deploymentEnabled: false`. `.github/workflows/release.yml` builds the web
346app with Vercel CLI as a staged production deployment (`--skip-domain`) while
347the desktop jobs run, and aliases the channel domains to it after the GitHub
348Release succeeds.
349​
350Required GitHub Actions secrets:
351​
352- `VERCEL_TOKEN`
353- `VERCEL_ORG_ID`
354- `VERCEL_PROJECT_ID`
355​
356Optional GitHub Actions variables:
357​
358- `VERCEL_TEAM_SLUG`: overrides the Vercel CLI scope when the team slug is preferred over the `VERCEL_ORG_ID` secret.
359- `T3CODE_WEB_ROUTER_URL`: defaults to `https://app.t3.codes`.
360- `T3CODE_WEB_LATEST_DOMAIN`: defaults to `latest.app.t3.codes`.
361- `T3CODE_WEB_NIGHTLY_DOMAIN`: defaults to `nightly.app.t3.codes`.
362​
363Required Vercel domains:
364​
365- `app.t3.codes`: the router domain users open, updated by stable releases.
366- `latest.app.t3.codes`: channel alias updated by stable releases.
367- `nightly.app.t3.codes`: channel alias updated by nightly releases.
368​
369The router domain uses `apps/web/vercel.ts` routes. Users opt into a channel by
370visiting `/__t3code/channel?channel=latest` or
371`/__t3code/channel?channel=nightly`; the router stores the
372`t3code_web_channel` cookie and rewrites future requests on `app.t3.codes` to
373the matching channel alias.
374​
375The release deploy job rewrites release package versions before upload so the
376hosted app's About panel renders the release version. Stable deploys alias the
377same deployment to both the `latest` channel and the router domain so the router
378rules stay current. Nightly deploys only alias the `nightly` channel. The job
379also passes `VITE_HOSTED_APP_CHANNEL=latest|nightly`, which renders the hosted
380update track selector in the About panel. Changing the selector navigates
381through `/__t3code/channel` on the router domain so the user's channel cookie is
382updated before redirecting to the hosted app root.
383​
384One-time Vercel dashboard setup:
385​
3861. Confirm the web project root directory remains `apps/web`.
3872. Add the three domains above to the web project.
3883. Disable automatic Git deployments in the dashboard if desired; the committed
389 `vercel.ts` setting is the source-of-truth, but disconnecting Git in the
390 dashboard is also safe.
3914. Run one stable release deployment, or manually alias the current stable
392 deployment, so `app.t3.codes` points at a deployment containing the router
393 rules in `apps/web/vercel.ts`. Future stable releases keep this alias current.
394​
395## Nightly builds
396​
397- Workflow: `.github/workflows/release.yml`
398- Triggers:
399 - scheduled check every 30 minutes
400 - manual `workflow_dispatch` with `channel=nightly`
401- Automatic nightlies require new commits and at least six hours since the last nightly was published, including manual nightlies.
402- Manual nightlies bypass the time and change checks. Nightly runs remain serialized. Scheduled runs wait for an active nightly to finish, then check the publication gap before building.
403- Runs the same desktop quality gates and artifact matrix as the tagged release flow.
404- Publishes a GitHub prerelease only:
405 - current tag format: `vX.Y.Z-nightly.YYYYMMDD.<run_number>`
406 - `nightly-v...` is accepted only as a legacy previous-nightly tag
407 - release name includes the short commit SHA
408 - `make_latest` is always `false`
409- Uses the next stable patch version as the nightly base. For example, `0.0.17` produces nightlies on `0.0.18-nightly.*`.
410- Publishes Electron auto-update metadata to the dedicated `nightly` updater channel, so desktop users can opt into that track independently from stable.
411- Publishes the `t3` npm launcher to the `nightly` npm dist-tag using the same nightly version.
412- Does not commit version bumps back to `main`.
413​
414## Server self-update release invariant
415​
416Connected servers update to the client's exact version, not to an npm dist-tag. Servers that update
417themselves download that version's CLI archive from the GitHub Release; servers run through npm are
418handed a `t3@<version>` command to run. Every released client version must therefore have its
419release archives, and then its npm launcher, available before users can receive that client.
420​
421The workflow enforces this ordering:
422​
4231. `release` publishes the GitHub Release with the CLI archives and `SHA256SUMS`.
4242. `publish_cli` publishes the `t3@<version>` launcher, which downloads from that release, on every
425 channel.
4263. `deploy_web` depends on both before moving the hosted channel to the new client.
427 `build_web` builds that client earlier with `vercel deploy --prod --skip-domain`, which
428 leaves the custom domains alone but moves the project's own `*.vercel.app` production
429 hostname. That hostname is behind Vercel SSO, so users only get the client through the
430 custom domains.
431​
432Desktop auto-update reads the GitHub Release directly, so a desktop client can see the new version
433a few minutes before `t3@<version>` is on npm. Only the copied manual command for npm-run servers
434depends on npm, and it works once `publish_cli` finishes.
435​
436Preserve these dependencies when changing the release graph. Publishing a client first would leave
437the **Update server** action targeting a package version that does not exist yet.
438​
439For a release smoke test, confirm `npm view t3@<version> version` returns the expected version, then
440connect the new client to a server on the previous version and verify that the update action
441reconnects to the matching server. When the release adds database migrations, verify that the
442remote update applies them and reconnects. A failed trial must restore the database snapshot and
443restart the previous server. If the installed launcher does not support the target protocol,
444verify that the update stops before restart and run `npx t3@<version> service update` once on the
445server machine. Also test the manual or desktop-managed guidance when those environments are
446available.
447​
448## Desktop auto-update notes
449​
450- Updater runtime: `apps/desktop/src/updates/DesktopUpdates.ts`.
451- `electron-updater` adapter: `apps/desktop/src/electron/ElectronUpdater.ts`.
452- `apps/desktop/src/main.ts` only wires the updater layers into the desktop runtime.
453- Update UX:
454 - Background checks run on startup delay + interval.
455 - No automatic download or install.
456 - The desktop UI shows a rocket update button when an update is available; click once to download, click again after download to restart/install.
457- Provider: GitHub Releases (`provider: github`) configured at build time.
458- Repository slug source:
459 - `T3CODE_DESKTOP_UPDATE_REPOSITORY` (format `owner/repo`), if set.
460 - otherwise `GITHUB_REPOSITORY` from GitHub Actions.
461- Required release assets for updater:
462 - platform installers (`.exe`, `.dmg`, `.AppImage`, `.deb`, plus macOS `.zip` for Squirrel.Mac update payloads)
463 - channel metadata: `latest*.yml` for stable releases, `nightly*.yml` for nightly releases
464 - `*.blockmap` files (used for differential downloads)
465- macOS metadata note:
466 - `electron-updater` reads `latest-mac.yml` on stable and `nightly-mac.yml` on nightly, for both Intel and Apple Silicon.
467 - The workflow merges the per-arch mac manifests into one channel-specific mac manifest before publishing the GitHub Release.
468​
469### Windows payload topology and update validation
470​
471Windows packages the bundled server and only its runtime-external/native
472dependency closure in `resources/server.asar`. Native modules and helper
473executables declared as unpacked by that archive must be present at the matching
474paths below `resources/server.asar.unpacked`. The Windows-native backend reads
475the archive in place through Electron. Packaged Windows builds also ship
476`resources/wsl-runtime.tar.gz` plus its SHA-256 sidecar: the Linux CLI archive
477(`t3-<version>-linux-<arch>.tar.gz`, the same arch as the Windows host) built
478by the Linux desktop job and handed to the Windows desktop build as
479`--wsl-runtime`, copied in verbatim so WSL runs the exact bytes a Linux user
480downloads. WSL verifies and extracts that archive
481into `~/.t3/wsl-runtime/sha256-<archive-digest>` inside the selected distro,
482then reuses it for later launches of the same update.
483​
484Windows keeps JavaScript and package metadata inside `app.asar` and unpacks only
485native libraries and helper executables. Avoid enabling whole-package smart
486unpacking: each loose file adds work to NSIS installation and counts against
487the payload limit.
488​
489The artifact builder rejects a Windows package when any of these invariants
490break:
491​
492- `resources/server.asar` is absent or does not contain the server entry.
493- Any file marked unpacked in the ASAR header is absent from
494 `resources/server.asar.unpacked`.
495- On same-architecture Windows builds, the packaged primary cannot load the fff
496 native library from inside `server.asar` through its `.unpacked` sibling.
497- The isolated, extracted sidecar cannot load the server entry with plain Node.
498- A Windows build given `--wsl-runtime` omits the WSL archive or SHA-256
499 sidecar, or the sidecar digest does not match the emitted archive.
500- The emitted WSL archive is not a Linux CLI release archive: it must unpack to
501 a single `t3-<version>-linux-<arch>` directory holding `t3`, `client/`, and
502 `node_modules/` with the Linux node-pty binary, and must not carry a loose
503 server bundle (`bin.mjs`).
504- The external Windows resource monitor is absent.
505- The unpacked Windows application contains more than 80 files.
506​
507Cross-architecture Windows builds retain every structural and extracted-sidecar
508check, but skip executing the target Electron binary. A same-architecture build
509for each release target must exercise the primary native-load probe.
510​
511NSIS differential packaging remains enabled. A sidecar layout transition can
512produce a larger one-time download; subsequent small releases retain their
513blockmaps, with a 60 MB maximum for a representative sidecar-to-sidecar update.
514​
515## 0) npm OIDC trusted publishing setup (CLI)
516​
517After the GitHub Release is published, the workflow runs `node scripts/build-npm-launcher.ts`, then
518`node apps/server/scripts/cli.ts publish --packages-dir npm-packages`, which runs `npm publish` on
519`t3.tgz`. That is the only package published per release.
520​
521Checklist:
522​
5231. Confirm the npm org owns package `t3`.
5242. For `t3`, configure a Trusted Publisher in the npm package settings:
525 - Provider: GitHub Actions
526 - Repository: this repo
527 - Workflow file: `.github/workflows/release.yml`
528 - Environment (if used): match your npm trusted publishing config
5293. Ensure npm account and org policies allow trusted publishing for the package.
5304. Create release tag `vX.Y.Z` and push; the workflow publishes the GitHub Release and then the
531 launcher with npm dist-tag `latest`.
5325. Nightly runs publish with npm dist-tag `nightly`; preview runs with `preview`.
533​
534## 1) Release validation and unsigned builds
535​
536There is no dry-run tag path. Pushing any accepted non-nightly tag, including
537`v0.0.0-test.1`, classifies the run as the stable channel. It publishes `t3` with npm dist-tag
538`latest`, creates a real GitHub Release, aliases the hosted app to `latest.app.t3.codes` and
539`app.t3.codes`, and can commit a version bump to `main` in the finalize job. Do not push a test tag
540to validate the workflow.
541​
542The workflow has no non-publishing `workflow_dispatch` mode. Use normal CI or local quality gates to
543validate checks and builds without shipping. To exercise the complete release graph at lower stable
544risk, manually dispatch `channel=nightly`; this still publishes a real nightly npm package, GitHub
545prerelease, desktop updater release, hosted nightly alias, and marketing site, but it does not update stable app aliases or
546commit a version bump to `main`. Only run it when a real nightly release is acceptable.
547​
548Manual `channel=stable` is also a real stable-channel release. Omitting signing secrets only makes
549platform artifacts unsigned; it does not prevent publication.
550​
551## 2) Apple signing + notarization setup (macOS)
552​
553Required secrets used by the workflow:
554​
555- `CSC_LINK`
556- `CSC_KEY_PASSWORD`
557- `APPLE_API_KEY`
558- `APPLE_API_KEY_ID`
559- `APPLE_API_ISSUER`
560- `MACOS_PROVISIONING_PROFILE` (base64-encoded provisioning profile with Associated Domains)
561​
562Required repository variables:
563​
564- `APPLE_TEAM_ID`
565​
566Optional repository variables:
567​
568- `CLERK_PASSKEY_RP_DOMAINS`: comma-separated RP-domain override. By default, the build derives the
569 domain from the production Clerk publishable key.
570​
571Checklist:
572​
5731. Apple Developer account access:
574 - Team has rights to create Developer ID certificates.
5752. Create an explicit App ID for `com.t3tools.t3code` and enable Associated Domains.
5763. Create a `Developer ID Application` certificate and a compatible provisioning profile for that
577 App ID with Associated Domains enabled.
5784. Export the certificate + private key as `.p12` from Keychain.
5795. Base64-encode the `.p12` and store as `CSC_LINK`.
5806. Base64-encode the provisioning profile and store it as `MACOS_PROVISIONING_PROFILE`.
5817. Store the `.p12` export password as `CSC_KEY_PASSWORD`, and set `APPLE_TEAM_ID` to the
582 10-character Apple Developer Team ID.
5838. In App Store Connect, create an API key (Team key).
5849. Add API key values:
585 - `APPLE_API_KEY`: contents of the downloaded `.p8`
586 - `APPLE_API_KEY_ID`: Key ID
587 - `APPLE_API_ISSUER`: Issuer ID
58810. Complete the Clerk Native API and AASA setup in [T3 Connect setup](./connect-setup.md#desktop-passkeys).
58911. Re-run a tag release and confirm macOS artifacts are signed/notarized and contain the expected
590 `com.apple.developer.associated-domains` entitlement.
591​
592Notes:
593​
594- `APPLE_API_KEY` is stored as raw key text in secrets.
595- The workflow writes it to a temporary `AuthKey_<id>.p8` file at runtime.
596- The workflow decodes `MACOS_PROVISIONING_PROFILE`, validates it with `security cms`, and passes it
597 to the desktop packager.
598- In-app browser passkeys depend on the same profile. The packager adds each entitlement only when
599 the profile grants it, because macOS will not launch an app that claims more than its profile
600 allows. The build log reports which ones it enabled.
601 - `keychain-access-groups` (`<TEAM_ID>.com.t3tools.t3code.webauthn`) enables Touch ID passkeys.
602 Profiles that grant the team's keychain groups (`<TEAM_ID>.*`) cover it.
603 - `com.apple.developer.web-browser.public-key-credential` lets the system passkey sheet (iCloud
604 Keychain, password managers, phones, security keys) serve any site. Apple grants it as a
605 managed capability: the Account Holder requests it through the
606 [macOS Browsers Passkeys form](https://developer.apple.com/contact/request/macos-browsers-passkeys/).
607 After approval, regenerate the profile and update `MACOS_PROVISIONING_PROFILE`.
608​
609## 3) Azure Trusted Signing setup (Windows)
610​
611Required secrets used by the workflow:
612​
613- `AZURE_TENANT_ID`
614- `AZURE_CLIENT_ID`
615- `AZURE_CLIENT_SECRET`
616- `AZURE_TRUSTED_SIGNING_ENDPOINT`
617- `AZURE_TRUSTED_SIGNING_ACCOUNT_NAME`
618- `AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE_NAME`
619- `AZURE_TRUSTED_SIGNING_PUBLISHER_NAME`
620​
621Checklist:
622​
6231. Create Azure Trusted Signing account and certificate profile.
6242. Record ATS values:
625 - Endpoint
626 - Account name
627 - Certificate profile name
628 - Publisher name
6293. Create/choose an Entra app registration (service principal).
6304. Grant service principal permissions required by Trusted Signing.
6315. Create a client secret for the service principal.
6326. Add Azure secrets listed above in GitHub Actions secrets.
6337. Re-run a tag release and confirm Windows installer is signed.
634​
635## 4) Ongoing release checklist
636​
6371. Pick the latest nightly and verify it: run the smoke test above against its artifacts and
638 check the nightly channel for regressions.
6392. Dispatch the Release workflow with `channel=stable`. Leave `version` empty unless the version
640 should differ from the one the nightly previewed.
6413. Confirm the `Resolve release commit` notice names the nightly tag and commit you verified. If a
642 newer nightly published in between, the run builds that one instead.
6434. Verify workflow steps:
644 - preflight passes
645 - release quality checks pass
646 - `build_bundle` and all platform builds pass
647 - `publish_cli` publishes the exact release version before the release job
648 - release job uploads expected files
6495. Smoke test downloaded artifacts.
650​
651## 5) Troubleshooting
652​
653- macOS build unsigned when expected signed:
654 - Check all Apple secrets plus `APPLE_TEAM_ID` are populated and non-empty.
655 - Confirm the provisioning profile belongs to `APPLE_TEAM_ID.com.t3tools.t3code` and includes
656 Associated Domains.
657- Windows build unsigned when expected signed:
658 - Check all Azure ATS and auth secrets are populated and non-empty.
659- Build fails with signing error:
660 - Retry with secrets removed to confirm unsigned path still works.
661 - Re-check certificate/profile names and tenant/client credentials.