Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .claude/skills/release/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
name: release
description: Release ensemble to prod — check stage, bump the version in a PR, publish the GitHub release, watch the deploy, and confirm what's live
disable-model-invocation: true
argument-hint: "[<version>]"
allowed-tools:
- Bash(gh run list *)
- Bash(gh run view *)
- Bash(gh run watch *)
- Bash(gh release list *)
- Bash(gh release view *)
- Bash(gh pr list *)
- Bash(gh pr view *)
- Bash(git remote -v)
- Bash(git fetch *)
- Bash(git rev-parse *)
- Bash(git log *)
- Bash(git status *)
- Bash(curl -s https://data.firefox.com/version.json)
- Read
- Grep
---

# /release — Release to prod

The steps are in "Releasing to prod" in `docs/architecture/deploy.md`. Read that section and
follow it; this file only adds what an agent needs to decide and when to stop for the user. If the
two disagree, the doc and `.github/workflows/deploy.yml` win; say so and suggest fixing this file.

## Before anything

1. Find the remote for `github.com/mozilla/ensemble` with `git remote -v`. It is often `mozilla`
rather than `origin`; this file calls it `<remote>`. Fetch it, then show:
- the latest prod release, leaving out drafts and pre-releases, which never reach prod
(`gh release list --exclude-drafts --exclude-pre-releases --limit 1`), and what prod reports
(`curl -s https://data.firefox.com/version.json`);
- the commits on `<remote>/main` since that release's tag, which are what this release ships;
- open PRs the user may want in first (`gh pr list`).
2. Check the stage deploy of `<remote>/main`'s tip. If it or its smoke test failed, find out why from
`gh run view <id> --log-failed` before going on. A failed smoke test doesn't undo a deploy, so
stage may be serving the code even though the run is red.

## Choosing the version

If no version was given, propose one. Use the README's "Versioning" scheme, which isn't semver: the
first digit for major changes, the second for medium, the third for small. Explain the choice from
the commits since the last release. The user decides; the version number is hand-managed, so never
bump it without asking.

## The bump PR

Branch off `<remote>/main` as `bump-version-<version>`, change only the three files the doc lists,
and open a PR titled "Bump version to <version>" in the shape of #513. Leave the merge to the user.

## Publishing

Once the bump PR is merged, fetch again and take the SHA to release, usually the bump's merge commit.
Show the user any other commits that reached `main` since the version was chosen. Wait until that
SHA's stage deploy and smoke test have passed (`gh run list --workflow=deploy.yml --commit <sha>`).

Publishing the release deploys to prod, which every visitor sees. Get an explicit go-ahead naming
the version and the SHA, then publish with `--target <sha>`, never `--target main`, which may have
moved on. Never pass `--prerelease`.

## After

Wait for the deploy run whose branch is the new tag, as the doc shows. Don't take the newest
release run straight after publishing; it may still be the previous release's. Check that run's
`headSha` is the SHA you released, then watch it to the end, including the smoke test. Check
`version.json` reports the new version and that SHA. Report the result plainly. If the smoke test
fails, the deploy still happened: read the failing tests and say whether the site or the test is at
fault. Suggest a rollback (re-running the deploy from the previous tag) only if the site itself is
broken, and only run one with the user's go-ahead.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ Any of the environment variables in *.env* can be overridden. For example:
Run `npm run build` to produce a static build in `build/` (Stylus, then Vite, then `version.json`;
see `CONTRIBUTING.md` for the full command reference). See [`docs/architecture/deploy.md`](docs/architecture/deploy.md) for where that build is
hosted and how it is deployed: pushes to `main` deploy to stage and GitHub releases deploy to prod,
via `.github/workflows/deploy.yml`.
via `.github/workflows/deploy.yml`. To release, follow "Releasing to prod" there, or run `/release`
in Claude Code.

Any of the environment variables in *.env* can be overridden.

Expand Down
30 changes: 30 additions & 0 deletions docs/architecture/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,36 @@ the public URL to serve the new bundle at the root and every route, checks an un
and the hardware dataset still answers. A separate `smoke-test` job then runs the live Playwright
project against the deployed URL. A failed smoke test does not undo the deploy; it flags it.

## Releasing to prod

Releases are tagged with the bare version, `2.1.0`, not `v2.1.0`. Run `/release` in Claude Code to
be walked through these steps.

1. **Bump the version** in a PR that touches `package.json`, `package-lock.json`, and the version
in `AGENTS.md`, as #513 did: `npm version 2.2.0 --no-git-tag-version`. The version isn't semver;
see "Versioning" in the README. Merge it just before releasing.
2. **Check stage.** Every push to `main` deploys to stage. Pick the commit to release, usually the
bump's merge commit, and wait for its stage deploy and smoke test to pass:
`gh run list --workflow=deploy.yml --commit <sha>`.
3. **Publish the release** from that exact commit. This creates the tag and starts the prod deploy:
`gh release create 2.2.0 --target <sha> --title 2.2.0 --generate-notes`. Use the SHA, not
`main`, which may have moved on to a commit stage hasn't checked. Don't mark it as a
pre-release: pre-releases test the release mechanics and never reach prod.
4. **Watch the deploy.** The run takes a few seconds to appear, and its branch is the tag, so wait
for that run rather than taking the latest one, which may be the previous release's:

```sh
until id=$(gh run list --workflow=deploy.yml --event=release --branch 2.2.0 --json databaseId -q '.[0].databaseId') && [ -n "$id" ]; do sleep 5; done
gh run watch "$id" --exit-status
```

The `prod` environment needs no approval, only a tag.
5. **Confirm what's live:** `curl -s https://data.firefox.com/version.json` should report the new
version and the SHA you released.

To re-run a prod deploy or roll back, run the workflow from the tag:
`gh workflow run deploy.yml --ref 2.0.0 -f environment=prod`.

## How deploys have happened

- Until 2018-07 the site ran on Heroku with the create-react-app buildpack (`app.json`,
Expand Down
Loading