---
name: release-process
description: WitnessWork's release workflow — trunk-based on `main`, version bump + release notes via `pnpm run bump-version`, and what each GitHub Actions workflow does. Use when opening a PR, asking which branch to target, cutting a release/version bump, writing release notes, or touching `.github/workflows/*.yml`.
---

# Release process

The project is **trunk-based on `main`**. PRs target `main` directly, and `main` is not GitHub-protected (no required status checks) — checks still run, they just aren't enforced as a merge gate.

## Branch naming

Bare `[feature-name]`, no `feature/`, `agent/`, or similar prefix (see AGENTS.md guardrails). `fix/...` and `refactor/...` prefixes show up in practice for those categories, but plain descriptive names (`calendar-sync`, `scribe-ai`) are the norm.

## Day-to-day PR flow

```bash
git checkout main
git pull
git switch -C my-feature

# commit, push, open PR against main
git push -u origin my-feature
```

EAS preview builds don't run automatically (they're expensive) — kick one off manually from the Actions tab: **Actions → PR Preview Build → Run workflow**, picking the PR's branch. Optionally pass the PR number as input to get an EAS-dashboard-link comment posted on the PR. The workflow still runs lint/typecheck/`testFinal`/circular-dep check first.

## Cutting a release

Use `/cut-release` for the complete main → local iOS build → local Android build → App Store and Google Play review workflow. It is explicitly user-invoked; its source is `.agents/skills/cut-release/SKILL.md`. Production steps also need the user to type the go-ahead keyword `SHIP-PROD-X.Y.Z` for the exact version. `.husky/pre-push` refuses a `v*` tag push, `build:prod-auto-submit` refuses to build, and `update:production` refuses to publish a production OTA (`docs/ota-updates.md`), unless `WW_RELEASE_CONFIRM` holds that keyword (`scripts/release-confirm.mjs`). Android builds immediately after the iOS build/upload from the same tagged commit and marketing version. Both stores must finish upload/processing and pass metadata/preflight checks before either review submission; a failure on either platform blocks both. The workflow reuses the exact localized ASC store notes for Play and configures automatic release after approval on both stores.

`scripts/bump-version.js` is a deterministic preparation tool. The invoking agent writes notes and translations; the script does not call a model or Azure.

```bash
pnpm run bump-version minor --notes-file .asc/cut-release-notes.json --prepare
# Or maintenance without an in-app announcement:
pnpm run bump-version patch --skip-notes --prepare
```

The notes file contains `{ "notes": ["User-facing change"] }`; `[]` omits the announcement. `--prepare` changes package/app versions and optional `src/features/updates/constants/releaseNotes.ts` / English updates keys, without committing. It requires a clean tree. Validate inputs before mutation; failures retain files/history for recovery.

Each `releaseNotes` entry has an optional `announce` level for first launch after updating. It defaults to `'passive'`: an item in the Home notifications tray, never blocking. Set `'silent'` for fix-only releases, which then appear only in Settings. Reserve `'sheet'` for rare, big releases that justify interrupting the user; the sheet lists only unseen releases. The first release at or past `UPDATE_REVEAL_VERSION` (`src/features/updates/constants/updateReveal.ts`) is a named Reveal update: give its entry `name: UPDATE_REVEAL_NAME` so What's New shows the same name as its launch reveal.

Feature PRs change only `en-US.json`; the release translates every other locale with `../translate-locales/SKILL.md`. After translation, run `pnpm run check:locales`, `pnpm sync:widget-shared`, `pnpm run check:all` and `pnpm run deps`. Add the release's upgrade fixture (`RELEASE_FIXTURE=X.Y.Z pnpm vitest run src/__tests__/releaseFixturesGenerate.test.ts`, see `docs/upgrade-fixtures.md`). Stage explicit release files, the new `src/__tests__/__data__/releases/vX.Y.Z/` included, commit `chore: bump version to X.Y.Z`, and create annotated `vX.Y.Z` with message `Release X.Y.Z`. Hooks stay enabled. The helper requires `--prepare` and never commits, tags or generates translations; the release skill owns those stages.

Push main and the specific release tag atomically:

```bash
export WW_RELEASE_CONFIRM=SHIP-PROD-X.Y.Z # typed by the user
git push --atomic origin main refs/tags/vX.Y.Z
pnpm run build:prod-auto-submit
```

The tag workflow validates and creates a GitHub Release; it does not build or upload. Production builds run locally via `eas build --local`, then upload with `asc builds upload`. Prerequisites are in `docs/build.md`. Upload is separate from Apple processing and App Review submission; see `../app-store-release/SKILL.md` for ASC operations.

`pnpm run build:prod-auto-submit` above remains the iOS build/upload command.
The release skill immediately follows it with the local Android production AAB
build from `docs/build.md`, stages a Play production draft with Fastlane `supply`,
and validates its full rollout alongside ASC preflight. It submits the exact Play
draft first, verifies review acceptance, then submits ASC; upload or draft success
alone does not complete a release. See `docs/build.md` for Play credentials,
shared-note locale/length handling, Console-only setup and automatic publishing,
and `../cut-release/recovery.md` for per-platform checkpoints and partial failures.

## Backend first (ww-api)

Beta and production builds both call the production ww-api Worker, so a feature's backend half must be deployed before any app build that relies on it. `scripts/release-api.sh` does this; `scripts/build-beta.sh` and `/cut-release` run it before building.

- ww-api's `v*` tags are the release state; no file tracks it. With no commits on ww-api `origin/main` since the latest tag, the script only confirms that tag's deploy run succeeded and production `/health` isn't older.
- Otherwise it installs, tests and typechecks ww-api in a throwaway worktree (`~/dev/ww-api-worktrees/`), commits `chore: release vX.Y.Z` (package.json only), tags, and pushes ww-api `main` and the tag atomically. Then it waits for ww-api's `deploy.yml` run and checks `/health`. Any `feat:` commit means a minor bump, otherwise patch; `--bump` overrides.
- `--branch <name>` (beta passes the app branch) fails when ww-api's branch of the same name has commits not on its `main`.
- `--dry-run` reports the pending release. Rerunning after any failure is safe.

The backend goes live before store review and stays live for older app versions, so keep its changes backward compatible.

## Workflows reference

| File                     | Trigger                                         | Does                                                                           |
| ------------------------ | ----------------------------------------------- | ------------------------------------------------------------------------------ |
| `pr-preview-build.yml`   | manual (`workflow_dispatch`)                    | lint/typecheck/test/deps, then EAS iOS preview build                           |
| `tests.yml`              | push → `main`                                   | lint/typecheck/test/deps                                                       |
| `production-release.yml` | tag push `v*.*.*`                               | locale completeness/lint/typecheck/test/deps, GitHub Release (no build/upload) |
| `claude.yml`             | `@claude` mention on issue/PR comment or review | Claude Code responds inline                                                    |
