Skip to main content

Web and Desktop Release

Every merge to qubital-apps' main builds the web app's image once and deploys it to staging. To ship, a person releases one commit that staging ran, as one version of both the web app and the desktop app: first a candidate the team tests, then a publish that puts it live. The steps are in Release the Web and Desktop Apps, Hotfix the Web and Desktop Apps and Roll Back a Deploy; why it works this way is in ADR-0007.

Words used on this page​

  • Staging and prod: staging is the team's test copy of the web app, https://app.qubital-test.com, on the staging backend and test data. Prod is https://app.qubital.space and the desktop apps people install.
  • Image: the web app packed to run on a server: nginx serving the built files (apps/web/Dockerfile). Images are stored in GHCR, GitHub's container registry.
  • Digest: an image's fingerprint, sha256: followed by 64 characters, computed from its exact bytes. A tag such as 6.0.2 is a label that could be moved to another image; a digest can't. Every deploy names its image by digest.
  • qubital-infra: the repository that says what runs on Northflank. A commit to its staging/webapp.json or production/webapp.json is a deploy (ADR-0006).
  • verify: qubital-infra's check, after every deploy, that Northflank runs what the file says. verified means it saw this deploy running. superseded means a newer commit was already live, which proves nothing about this one.
  • Staging proof: how the release knows staging ran a commit. The qubital-infra commit that deployed it is found by its Source-Commit: line, and its verify must say verified. The commit's web-staging deployment record in GitHub must also say success.
  • Smoke check: apps/web/scripts/check-web.sh, run against the live site after a deploy. It checks that the site answers, serves the deployed commit with the environment's values, and sends the right headers.
  • Candidate: a release that is built, signed and uploaded, but not live. The team tests its exact files.
  • Publish: the stage that puts a tested candidate live.
  • Dry run: a run with dry_run checked. It runs every check and changes nothing.
  • Draft release: a GitHub release that isn't published yet. The candidate creates one, which reserves its version.
  • Feed: https://releases.qubital.space, a public Cloudflare R2 bucket. Installed desktop apps update from it, and the web app's download buttons point at it.
  • Manifest: a small file at the feed's root that names the current desktop version and its files: latest.yml for Windows, latest-mac.yml for Mac. An installed app reads its manifest to decide whether to update.
  • Blockmap: a list of a file's pieces, stored next to it as .blockmap. With it, an update downloads only the pieces that changed.
  • Runtime config: values the web image reads when its container starts, such as the API's address. Changing one needs no new build.
  • Release flag: an on/off switch in the app's code, with one value for staging and one for production, so unfinished work can sit on main without reaching users.
  • API contract: the npm package @startingquotechdivision/api-contract, generated from the backend's API. The backend publishes it as a plain X.Y.Z once prod runs that version; staging builds are 0.0.0-staging.<commit>.

The big picture​

Two things to notice. The web image is built once, at the merge, and prod later runs those exact bytes. And nothing reaches prod until a person starts the release.

Every merge to main​

Before the merge​

"ci: pull request check" (ci.yml) runs on every pull request. It runs the release scripts' tests, the app tests that need nothing installed (the content security policy's, and the Sentry reporting of what it blocks), the type check, lint, and a lint of the image's shell scripts. When the change can reach the web app, it also builds the web app and its image, runs the image check (apps/web/scripts/check-image.sh) and a Trivy scan for known security holes, which only advises. The web build is skipped only when every changed file is under apps/desktop/ or apps/website/, or is a .md file.

What the staging workflow does​

"ci: web app to staging" (web-staging.yml) runs on every push to main, in two jobs.

  1. Build, check and push the web image. It runs the release scripts' tests, then builds the web app, type check included, from the commit that landed. The build uploads its source maps to Sentry and deletes them. The workflow packs the image and runs the image check. Only then does it push the image to GHCR as qubital-webapp-staging:sha-<commit>, and it reads the digest back.
  2. Deploy to staging.
    • It decides whether this run deploys (see below).
    • It records a web-staging deployment of the commit in GitHub, "in progress".
    • It writes the digest into qubital-infra's staging/webapp.json, as the GitHub App qubital-infra-deployer. The commit is titled deploy(staging/webapp): …; its Source-Commit: line names the qubital-apps commit.
    • Northflank applies it. The job waits up to 50 minutes for verify to go green.
    • It runs the smoke check against https://app.qubital-test.com, through Cloudflare Access with a service token (Staging Web App Access). A failed check is tried twice more, 10 seconds apart.
    • It marks the deployment record success or failure. A release ships only a commit whose latest web-staging record is success.

When a merge doesn't deploy​

  • Website-only and Markdown-only merges deploy nothing: when every changed file is under apps/website/ or is a .md file, the workflow doesn't start.
  • Desktop-only merges deploy too. The web app may not change, but a release ships web and desktop from one commit, and only a commit staging ran successfully.
  • One deploy at a time. Runs wait in one lane. GitHub keeps at most one run waiting, and a newer one replaces it. After three quick merges, the second run is cancelled and the third deploys; its code holds the second's changes.
  • Staging never moves back. A re-run of an older run deploys nothing when staging has already run a later commit of main that contains it.
The merge changesStaging deploys?
apps/website/… and MONOREPO.md onlyNo: the workflow doesn't start
apps/desktop/… onlyYes
packages/app-core/…Yes

The hotfix hold. In an emergency, a person can deploy a hotfix/<name> branch to staging by starting "ci: web app to staging" by hand with that branch as ref. Staging then holds the hotfix: merges to main keep building images, but none of them deploys, and each run says so in a warning. The hold ends when someone starts the workflow by hand with ref main, which deploys main's newest commit; reverting the hotfix's deploy in qubital-infra doesn't end it. While the hold lasts, no newer commit of main can be released, because staging never ran it. The steps are in Hotfix the Web and Desktop Apps.

Old staging images​

"ci: GHCR image cleanup" (ghcr-cleanup.yml) runs every Monday at 04:17 UTC. In qubital-webapp-staging it keeps every image from the last day, the 15 newest tagged images before that, and every untagged one, and it deletes the other tagged ones. A deleted image can be restored from the package's settings for 30 days. It never touches qubital-webapp-prod, whose images are kept for good.

So staging can roll back about 15 builds, and a commit whose staging image was deleted can't be released: the release checks that GHCR still has it.

The release​

One version, from one commit​

The release is the workflow "release: web and desktop" (release.yml), started by hand from main: Actions → "release: web and desktop" → Run workflow. It always ships the web app and the desktop app together, under one version X.Y.Z, built from one commit that staging ran and verify saw running. Its scripts (.github/scripts/release/) always run from main's copy of the workflow, even when the commit released is older or on a hotfix branch. Only one release runs at a time; a second one waits.

InputCandidatePublish
stagecandidatepublish
versionthe new version, X.Y.Z, without a vthe candidate's version
committhe full 40-character SHA of a commit staging ran; empty means the commit staging runs nowempty: publish refuses one, it takes the candidate's
dry_runchecks onlychecks only
release_summaryoptional: a few sentences for the top of the release notesempty: publish refuses one; edit the draft's text instead

Stage 1: the candidate​

The candidate builds everything the release ships and puts none of it live, so the team tests the exact bytes customers will get. Its jobs, by the names GitHub shows:

  • Check the candidate. The checks, cheapest first:

    • the run started from main, and the inputs have the right shape;
    • the release scripts' own tests pass, and every secret and variable it needs is set;
    • the commit: the one given, or the one staging runs now, read from the newest Source-Commit: line on staging/webapp.json (and then the file must still name the image that deploy wrote);
    • the staging proof: the deploy that put the commit on staging, whose verify must say verified; and GHCR still has that staging image;
    • the version is above every earlier one (see "Versions only go up");
    • the commit may be released: it is on main and contains the last release from main, or it is on a hotfix/* branch cut from the highest release tag; and its latest web-staging record is success;
    • the API contract check (below);
    • apps/desktop/.env.production sets none of the values the release writes;
    • the workflow-files check (below);
    • no file of this version is in the feed bucket yet;
    • the R2 probe: it writes a small object to the builds bucket, checks that R2 refuses to overwrite it, then deletes it;
    • qubital-infra's own rules would take the prod deploy, checked without committing anything;
    • it reads the desktop's config from production/webapp.json (see "Runtime config").

    Then, unless it is a dry run, it creates the draft release v<version> on the commit, which reserves the version.

  • Copy the web image into the prod package. It copies the image staging ran into qubital-webapp-prod, tagged with the version, by digest. It reads the copy back and checks that its digest is the staging image's. Production is never rebuilt.

  • Build the Mac app, on a GitHub macOS runner. It builds three apps with prod's values: a universal one for the dmg, and one for Intel and one for Apple silicon for the update zips. Each is signed with the Developer ID certificate, notarized by Apple, and stapled (Apple's notarization ticket is attached to the app). Then it checks each app's chips, that no source map is inside, and the signature, notarization and staple of each app as built, inside the dmg and inside each zip. It also checks that latest-mac.yml names the two zips and nothing else.

  • Build the Windows app, on a GitHub Windows runner. It builds the NSIS installer, its blockmap and latest.yml. The installer ships unsigned until the company can sign it: the signing step is empty, and the job only reports the signature.

  • Upload the candidate. It writes candidate.json: the version, the commit, the web image's digest, the qubital-infra commit the desktop config came from, and every file with its size and SHA-512. It runs publish's own check of the candidate before writing anything. Then each versioned file goes to the feed bucket's root, never over another file. The two manifests and candidate.json go to the private builds bucket, under desktop/candidates/<version>/. It reads them back and checks them again.

  • Fill the draft release. It writes the draft's notes: the summary, download links for testers, what it was built from (commit, API contract, web image, desktop config, run), and the changes since the last release tag.

Nothing live changes: the manifests and latest/ on the feed stay as they were. The candidate's installers are on the public feed under their versioned names, such as Qubital-6.0.3-setup.exe, and only the draft links to them.

The candidate's desktop apps talk to prod. The desktop app can't read runtime config, so the values it shares with the web app are built in. The candidate reads five of them from production/webapp.json on qubital-infra's main: API_URL, LIVEKIT_URL, REALTIME_ORIGIN, AVATARS_ORIGIN and STORAGE_ORIGINS. It writes them into the build as VITE_API_URL and so on, and checks that the build holds them. So both apps use the same addresses, and a tester of the candidate signs in to the prod backend.

Stage 2: publish​

  1. Check the publish. The checks again, cheapest first. The version isn't below what either feed serves. The candidate is the one built: one draft release v<version> targets its commit, no release is above it, the prod image tagged with the version is its web image, and its manifests name its files alone. The commit may still be released and tagged, and still installs a prod API contract. The five desktop values in production/webapp.json are still the ones the candidate was built with. Every file of candidate.json is in the feed bucket with its recorded size and SHA-512. R2 takes writes, and qubital-infra would take the deploy.
  2. Deploy the web app to prod. It writes the candidate's digest into production/webapp.json, waits for verify to say verified, then runs the released commit's smoke check against https://app.qubital.space. A production deployment record covers it all. The run's summary names the qubital-infra deploy commit: reverting it rolls the web app back.
  3. Put the desktop update live. It copies the two installers to latest/Qubital-Setup.exe and latest/Qubital-universal.dmg, where the download buttons point. Then it puts latest.yml live, then latest-mac.yml. Then it reads https://releases.qubital.space over HTTPS to check that it serves them.
  4. Tag and publish the release. It creates the annotated tag v<version> on the commit (a tag with a message: the web image and the run), then publishes the draft release as the latest one. Its notes open with "Live." instead of the candidate's first line, and "Downloads for testing" becomes "Downloads", if the draft still has that first line; otherwise they are published as written.

The order is the safety. The web app goes first, because a git revert in qubital-infra rolls it back. The desktop pointers go second, because an installed app never goes back to an older version. The tag and the release go last, once everything they record is live.

Dry runs​

  • A candidate dry run runs "Check the candidate" alone: every check, the R2 probe included. It creates no draft, image, build or upload.
  • A publish dry run runs "Check the publish" alone, with the same probe. It deploys, copies, tags and publishes nothing.

The probe is the only write either makes, and it deletes it. A dry run before each real run catches a wrong version, a missing secret or a staging contract pin in minutes, before the Mac build is paid for.

Re-runs: "Re-run all jobs" only​

Every job after the checks makes sure the checks ran in the same attempt, and refuses otherwise. "Re-run failed jobs" would reuse an earlier attempt's checks, which may be out of date.

  • Publish: each step finds its work done, or does it again with the same result. So once the cause of a failure is fixed, "Re-run all jobs" finishes the publish.
  • Candidate: a re-run with the same version and commit reuses its draft and its image tag. But once any file of the version is in the feed bucket, the checks refuse the version, because a rebuilt installer never has the same bytes. Then build the next version. When only "Fill the draft release" failed, the candidate is complete: write the draft's text by hand from the run's summary. Publish doesn't depend on it: it publishes hand-written notes as they are.

The header of release.yml lists what each failed job leaves behind, and what a re-run can't finish.

Versions only go up​

  • A version is X.Y.Z: no v, no leading zeros, no suffix.
  • A candidate's version must be above every release tag, every GitHub release (draft or published) and the version each feed serves.
  • So building a candidate uses up its version: once its files are on the feed, that version can never be built again, and an abandoned candidate leaves a gap. While its draft exists, every version below it is refused too.
  • Publish puts live only the highest candidate (no release, draft or published, above it), and never a version below what a feed serves.

Example. Prod runs 6.0.2, and a candidate 6.1.0 waits as a draft. Another candidate must be 6.1.1 or higher: 6.0.3 is refused while the 6.1.0 draft exists. If 6.1.0 is abandoned, it can never be built again, as its files are on the feed; once its draft is deleted, any other version above 6.0.2 is accepted, and 6.1.1 or higher keeps the order simple.

Why there's no web-only or desktop-only release​

Both apps are built from the same code and call the same backend. One version from one commit means 6.0.2 names one set of code everywhere: on the web, on Windows and on Mac. The desktop app is also built with the prod web app's values, checked again at publish. The cost: when one platform can't build, for example during an Apple notarization outage, the whole release waits.

The API contract check​

A release must not need a backend that prod doesn't run yet, or customers get an app that calls endpoints that don't exist. So the backend ships first, and the release checks the contract the commit installs, as its pnpm-lock.yaml has it. The pin lives in the catalog of pnpm-workspace.yaml.

  • It must be a plain X.Y.Z. A staging contract, 0.0.0-staging.<commit>, is refused: prod may never have run that backend.
  • It must be of the major prod runs, and not above it. "What prod runs" is the registry's latest tag for the contract, which only the backend's promote moves, once prod runs the new version.
  • The candidate checks it, and publish checks it again.
Prod's backend contractThe app installsResult
6.2.06.0.0Passes
6.2.06.3.0Refused: newer than prod
6.2.05.4.0Refused: another major
6.2.00.0.0-staging.abc1234Refused: a staging contract

The check can't see a backend rollback: latest stays on the newer version. So after a backend rollback, no web or desktop release goes out until the backend is forward again.

The workflow-files check​

GitHub doesn't let a workflow's own token create a tag on a commit whose .github/workflows folder differs from the one at the head of a branch. So the release checks, at the candidate and again at publish, that the commit's .github/workflows is the one at the head of main, or of the hotfix/* branch it is on. If a pull request that changes .github/workflows merges after the commit:

  • at the candidate, it is refused: release a later commit, once staging has run it;
  • at publish, it is refused before anything goes live: create the tag v<version> on the commit by hand, with credentials allowed to change workflows, then run publish again; or build a new candidate;
  • during a publish, after its checks, the tag step fails with everything else live: create the tag by hand as the error says, then "Re-run all jobs".

So don't merge a change to .github/workflows while a candidate waits.

Desktop updates​

Windows​

  • The installer, Qubital-<version>-setup.exe, is made with NSIS, a common Windows installer builder, and comes with its blockmap. latest.yml names it.
  • It is unsigned until the company can sign it. On a fresh download, Windows SmartScreen shows its warning: "More info" → "Run anyway" installs it.

Mac​

  • To install: latest/Qubital-universal.dmg, behind the download button. Its app runs on both kinds of Mac, Intel and Apple silicon.
  • To update: one zip per chip, Qubital-<version>-x64.zip and Qubital-<version>-arm64.zip, each with its blockmap, both listed in latest-mac.yml. Each Mac takes the zip for its chip. The dmg isn't in the manifest.
  • Why not one universal zip: its main framework file holds the Intel code first, and the zip compresses the file as one stream. The new signature on the Intel code changes every compressed byte after it, so each update would download about 60 MB of unchanged Apple silicon code again.
  • Each of the three apps is signed with the Developer ID certificate, notarized and stapled, so macOS opens it without a warning.

When an installed app updates​

  • The app checks its manifest at start, then every 4 hours (apps/desktop/src/main/updateManager.ts). It downloads a newer version in the background.
  • Found at start: a new major or minor version, such as 6.1.0 over 6.0.2, shows a notice and installs as soon as it has downloaded. A patch, such as 6.0.3, asks "Install on next launch" or "Install now".
  • Found by a later check: it installs, without a word, when the app quits. But if the check at start failed, say because the machine was offline, the first check that works takes its place: if it finds an update, it shows the same notice or question.
  • It never downgrades: it installs only a higher version than its own. That is why the desktop is fixed forward, never rolled back.
  • The first update after a change of file format downloads the whole file once. The pieces are compared with the blockmap of the installed version's file. 6.0.2's Mac update zip was universal, so it has no per-chip blockmap: the first Mac update from 6.0.2 downloads its whole zip once.
  • A failed update shows nothing: the app only logs the error.
  • Qubital Offline, the build against the backend's local stack, never updates.
  • Windows: https://releases.qubital.space/latest/Qubital-Setup.exe. Mac: https://releases.qubital.space/latest/Qubital-universal.dmg. They are fixed in packages/app-shared/src/common/utils/desktopAppDownload.ts.
  • The web app offers them in a browser on Windows or Mac: the dashboard banner "Get the desktop app", the "Get the desktop app" item of the profile menu, and a button on the sign-in page. Staging shows the same links, to prod's files.
  • Publish copies each new installer there. The latest/ copies are cached for 5 minutes; the versioned files for a year, as they never change.

Macs on a build from before 6.0.2​

A Mac that runs a build from before 6.0.2 must reinstall once, by hand, from latest/Qubital-universal.dmg. Those builds were signed ad hoc, not with the Developer ID, and the Mac updater accepts only an update that matches the running app's own signature requirement, which for an ad hoc build matches nothing but itself.

Where things live​

WhatWhereWritten by
Web image of each mergeGHCR package qubital-webapp-staging, tag sha-<commit>"ci: web app to staging"
Released web imagesGHCR package qubital-webapp-prod, tag <version>; never deletedThe candidate
What staging runsqubital-infra, staging/webapp.jsonThe staging workflow for the image; people by pull request for the rest
What prod runsqubital-infra, production/webapp.jsonPublish for the image; people by pull request for the rest
The public feedAn R2 bucket served at https://releases.qubital.space (named by the repository variable R2_FEED_BUCKET): versioned files at the root, latest/, the two manifestsThe candidate (versioned files); publish (latest/, manifests)
Candidates waiting to publishA private R2 bucket (repository variable R2_BUILDS_BUCKET), desktop/candidates/<version>/: both manifests and candidate.jsonThe candidate
The release recordGitHub release and annotated tag v<version> in qubital-appsThe candidate (draft); publish (tag, published)
Deployment recordsGitHub deployments of qubital-apps: web-staging and productionThe staging workflow; publish
Staging web apphttps://app.qubital-test.com, team only, behind Cloudflare Access (Staging Web App Access)—
Prod web apphttps://app.qubital.space, public—
Release flagspackages/app-shared/src/config/releaseFlags.tsPull requests to qubital-apps

The secrets the pipeline uses are listed, with how to rotate each, in Rotate a Secret.

Runtime config and release flags​

Runtime config​

One image runs in every environment. When its container starts, apps/web/nginx/05-qubital-config.envsh reads the values from the file's runtimeEnvironment, checks each against what it may hold, writes /config.js and fills in the content security policy's hosts. A missing or malformed value stops the container before nginx starts: the deploy never becomes ready, and the version already running keeps serving.

KeyWhat it isUsed by
API_URLThe backend/config.js, the policy; the desktop build
LIVEKIT_URLThe LiveKit server for calls/config.js, the policy; the desktop build
REALTIME_ORIGINThe realtime brokerThe policy; the desktop build
AVATARS_ORIGINWhere avatars and logos are served fromThe policy; the desktop build
STORAGE_ORIGINSWhere uploads go and downloads come from, comma-separatedThe policy; the desktop build
SENTRY_DSNThe web app's Sentry project (the desktop app has its own)/config.js, the policy
ENVIRONMENTstaging or production/config.js: it picks each release flag's value and Sentry's rates
  • The web app picks up a changed value at once: merging the change restarts the container, and /config.js is never cached, so the next page load gets it.
  • The desktop app picks it up only at its next release: its values are built in, from production/webapp.json as it was when the candidate was built. A change to one of the five shared values after that makes the waiting candidate's publish refuse: build a new candidate.

The steps are in Change a Web App Setting or Release a Flag.

Release flags​

A release flag holds a staging value and a production value, in RELEASE_FLAGS (packages/app-shared/src/config/releaseFlags.ts), and the code asks isReleased('<flag>'). There are none today. For example:

const RELEASE_FLAGS = {
newBilling: { staging: true, production: false }
} satisfies Record<string, ReleaseFlagValues>;
Where the app runsThe value it reads
Local developmentstaging
The staging web appstaging
The prod web appproduction
A released desktop appproduction (a release build always runs as production)

A flag's value changes only by a commit, so it reaches prod with the next release, on the web and the desktop together. Once its feature has shipped, the flag and the code path it switched off are removed.

Safety nets​

  • Pinned by digest. Every deploy names its image by digest, and prod runs the exact image staging ran: copied, never rebuilt, and read back to compare. qubital-infra's rules also refuse a prod web image that was never staging's (rule 9, in its docs/architecture.md).
  • Security headers on every response: the content security policy, X-Content-Type-Options: nosniff, Referrer-Policy: no-referrer (a guest's invite secret sits in the URL) and X-Robots-Tag: noindex, nofollow. The policy lets the page call only the hosts it needs, most of them from its runtime config, and no other site may frame it (frame-ancestors 'none'). Source maps are never served.
  • Every deploy is smoke-checked: /healthz, /config.js against the file's values, /version.json against the deployed commit, the headers and the policy's hosts on several pages, and a 404 for a missing file.
  • What the policy blocks is reported to Sentry, as a warning: one issue per directive and blocked origin, at most 10 reports per page load, ignoring browser extensions. The app reports it itself, through the same scrubbing as its errors: guest-link secrets, invite tokens and LiveKit's access tokens are filtered out of URLs, and the user's email and IP address are dropped. A browser's own report would carry the page's URL past those filters.
  • Local development sends nothing to Sentry: the development env files hold no Sentry DSN, and the app starts Sentry only when it has one.

The design is in qubital-infra's architecture: D19 (the web app's image and runtime config), D22 (the release workflow and the desktop files) and D23 (the release flow: backend first, flags, hotfixes, rollbacks).