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
26 changes: 26 additions & 0 deletions .github/release_failure_notify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Posts a failed release to Slack, from release.yml.
# usage: release_failure_notify.sh <step> (e.g. "build", "publish")
# Env: SLACK_BOT_TOKEN, TAG, ACTOR, RUN_URL, and CI_LOG_ID when the build reached an instance.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
step=${1:?usage: release_failure_notify.sh <step>}

# The release channel, not the tag name, decides whether this is worth reporting:
# a 'commit' tag is a per-commit build, which nobody wants alerts for.
channel=$(./ci3/dist_tag)
if [ "$channel" = "commit" ]; then
echo "Canary release ($TAG); not notifying."
exit 0
fi
case "$channel" in
nightly) kind="Nightly release" ;;
rc) kind="Release candidate" ;;
*) kind="Release" ;;
esac
text="$kind $step FAILED for *${TAG}* (${ACTOR}): <${RUN_URL}|View Run>"
# Set by ci3/bootstrap_ec2 once the build reaches the instance; absent if we failed earlier.
if [ -n "${CI_LOG_ID:-}" ]; then
text="${text} | <http://ci.aztec-labs.com/${CI_LOG_ID}|Build Log>"
fi
./ci3/slack_notify "$text" "#team-alpha-ci"
96 changes: 70 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Publishes a release: npm packages to npmjs, docker images to DockerHub, and the aztec-up and
# playground assets to S3. See RELEASES.md for how a tag gets here.
# Publishes a release: npm packages to npmjs, docker images to DockerHub, the aztec-nr mirror, and
# the aztec-up and playground assets to S3. See RELEASES.md for how a tag gets here.
#
# The release job builds on EC2 and pushes only the per-arch docker images from there; everything
# else is staged into the release cache and published by the publish job on this runner, with npm
# trusted publishing (no npm token).
#
# Split out from ci3.yml so that the `release` environment — which holds the only publish
# credentials in the repo — is requested by exactly one workflow whose only trigger is a v* tag,
Expand All @@ -22,7 +26,7 @@ concurrency:
cancel-in-progress: false

jobs:
# Orchestrates the amd64 + arm64 EC2 jobs and assembles the multi-arch docker manifest;
# Orchestrates the amd64 + arm64 EC2 jobs, which push their docker images and stage the rest;
# see ci.sh::release. Runs no tests.
release:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -58,10 +62,6 @@ jobs:
GITHUB_ACTOR: ${{ github.actor }}
NPM_REGISTRY: https://registry.npmjs.org
DOCKER_REGISTRY: docker.io/azteclabs
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# Private half of the aztec-nr mirror repo's write deploy key, which github.token cannot
# push to.
AZTEC_NR_GITHUB_MIRROR_DEPLOY_KEY: ${{ secrets.AZTEC_NR_GITHUB_MIRROR_DEPLOY_KEY }}
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
# The tag, matching what ci3_labels_to_env.sh computes for a tag push. Only read by
Expand All @@ -86,22 +86,66 @@ jobs:
TAG: ${{ github.ref_name }}
ACTOR: ${{ github.actor }}
RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
# The release channel, not the tag name, decides whether this is worth reporting:
# a 'commit' tag is a per-commit build, which nobody wants alerts for.
channel=$(./ci3/dist_tag)
if [ "$channel" = "commit" ]; then
echo "Canary release ($TAG); not notifying."
exit 0
fi
case "$channel" in
nightly) kind="Nightly release" ;;
rc) kind="Release candidate" ;;
*) kind="Release" ;;
esac
text="$kind FAILED for *${TAG}* (${ACTOR}): <${RUN_URL}|View Run>"
# Set by ci3/bootstrap_ec2 once the build reaches the instance; absent if we failed earlier.
if [ -n "${CI_LOG_ID:-}" ]; then
text="${text} | <http://ci.aztec-labs.com/${CI_LOG_ID}|Build Log>"
fi
./ci3/slack_notify "$text" "#team-alpha-ci"
run: ./.github/release_failure_notify.sh build

# Publishes what the release job staged: the aztec-nr mirror, the npm packages, the aztec-up
# installer and the playground, then the multi-arch docker manifests over the per-arch images the
# release job pushed. See bootstrap.sh::publish.
publish:
needs: release
runs-on: ubuntu-latest
# The environment each package's npm trusted publisher names. Its AWS_OIDC_ROLE_ARN is the
# release role, which can read the release cache and write the install and playground buckets.
environment: release
permissions:
id-token: write # AWS OIDC, and npm trusted publishing
contents: read
steps:
# Do NOT bump actions/checkout to v6 (see the pinning rationale in ci3.yml). ci3 is the only
# submodule.
- name: Checkout
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
with:
submodules: true
ref: ${{ github.sha }}
fetch-depth: 1
persist-credentials: false

- name: Configure AWS credentials (OIDC)
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.AWS_OIDC_ROLE_ARN }}
aws-region: us-east-2
role-session-name: publish-${{ github.run_id }}

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22

# Trusted publishing needs npm >= 11.5.1; Node 22 ships an older npm.
- name: Update npm
run: npm install -g npm@^11.5.1 && npm --version

# The bundle is downloaded through authenticated S3 with this job's AWS role and extracted
# outside the checkout; each channel then refuses anything not at exactly this tag's version.
- name: Publish
env:
S3_BUILD_CACHE_AWS_PARAMS: --region us-east-2
NPM_REGISTRY: https://registry.npmjs.org
DOCKER_REGISTRY: docker.io/azteclabs
# Private half of the aztec-nr mirror repo's write deploy key, which github.token cannot
# push to.
AZTEC_NR_GITHUB_MIRROR_DEPLOY_KEY: ${{ secrets.AZTEC_NR_GITHUB_MIRROR_DEPLOY_KEY }}
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
run: ./bootstrap.sh publish

- name: Notify Slack on publish failure
if: failure()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
TAG: ${{ github.ref_name }}
ACTOR: ${{ github.actor }}
RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: ./.github/release_failure_notify.sh publish
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ __pycache__

# Local opt-in: install nargo from the matching official noir release instead of building from source.
noir-from-release.flag
# What a release stages (bootstrap.sh release), and the aztec-nr mirror push's working tree.
release-out
4 changes: 2 additions & 2 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Releases

Releases are driven by git tags. Each branch's version is tracked in its `.version-manifest.json` at the project root. Tags are created exclusively through the release GitHub App, by two workflows: the [nightly release tag workflow](./.github/workflows/release-tag-nightly.yml), which runs only on its schedule, and the [release tag workflow](./.github/workflows/release-tag.yml), which runs only on a dispatch — a ruleset restricts tag creation on every ref to that App, which repository admins can bypass, and a second ruleset with no bypass actors constrains every tag name to `v<semver>` or `private/v<semver>`. Nightly tags (`v<ver>-nightly.<date>`) are cut every night for each branch in the nightly workflow's matrix. A dispatch of the release tag workflow with `kind=nightly` cuts one on demand, for a day the cron missed or botched; it takes an optional `suffix` (`v<ver>-nightly.<date>.<suffix>`, 1-20 lowercase letters and digits starting with a letter) so a re-cut does not collide with a tag the cron already pushed. A re-cut is released like any nightly and takes the nightly aliases from the day's scheduled build; since suffixes are words rather than a sequence, two re-cuts on one day have no meaningful order between them. The suffix is its own prerelease identifier, so the release channel stays `nightly` and the tag sorts after the day's scheduled one. Scheduled runs never carry a suffix, so the plain date tag remains what scheduled consumers resolve. A release candidate (`v<ver>-rc.<n>`, with `n` auto-incremented from origin's existing rc tags) is a manual dispatch with `kind=rc`; a real release (`v<ver>`) is a manual dispatch with `kind=stable`. Every dispatch pauses for a second person's approval, a nightly re-cut included; the cron is the only unattended path. A dispatch names the commit to tag by its full SHA, which the approval screen shows, so the second person approves the exact commit that gets tagged; the version comes from that commit's manifest. Neither workflow acts on a re-run, so every tag comes from a fresh scheduled run or a freshly approved dispatch. No dispatch ever moves an existing tag: a run whose tag is already on origin fails instead of retagging. A new tag triggers the [release workflow](./.github/workflows/release.yml), which runs `./bootstrap.sh release` to build and publish the version at that tag: the aztec-nr crates as a tagged snapshot on the [aztec-nr mirror](https://github.com/aztec-labs-eng/aztec-nr) (which `aztec init` pins), npm packages to npmjs, docker images to DockerHub, and the aztec-up and playground assets to S3.
Releases are driven by git tags. Each branch's version is tracked in its `.version-manifest.json` at the project root. Tags are created exclusively through the release GitHub App, by two workflows: the [nightly release tag workflow](./.github/workflows/release-tag-nightly.yml), which runs only on its schedule, and the [release tag workflow](./.github/workflows/release-tag.yml), which runs only on a dispatch — a ruleset restricts tag creation on every ref to that App, which repository admins can bypass, and a second ruleset with no bypass actors constrains every tag name to `v<semver>` or `private/v<semver>`. Nightly tags (`v<ver>-nightly.<date>`) are cut every night for each branch in the nightly workflow's matrix. A dispatch of the release tag workflow with `kind=nightly` cuts one on demand, for a day the cron missed or botched; it takes an optional `suffix` (`v<ver>-nightly.<date>.<suffix>`, 1-20 lowercase letters and digits starting with a letter) so a re-cut does not collide with a tag the cron already pushed. A re-cut is released like any nightly and takes the nightly aliases from the day's scheduled build; since suffixes are words rather than a sequence, two re-cuts on one day have no meaningful order between them. The suffix is its own prerelease identifier, so the release channel stays `nightly` and the tag sorts after the day's scheduled one. Scheduled runs never carry a suffix, so the plain date tag remains what scheduled consumers resolve. A release candidate (`v<ver>-rc.<n>`, with `n` auto-incremented from origin's existing rc tags) is a manual dispatch with `kind=rc`; a real release (`v<ver>`) is a manual dispatch with `kind=stable`. Every dispatch pauses for a second person's approval, a nightly re-cut included; the cron is the only unattended path. A dispatch names the commit to tag by its full SHA, which the approval screen shows, so the second person approves the exact commit that gets tagged; the version comes from that commit's manifest. Neither workflow acts on a re-run, so every tag comes from a fresh scheduled run or a freshly approved dispatch. No dispatch ever moves an existing tag: a run whose tag is already on origin fails instead of retagging. A new tag triggers the [release workflow](./.github/workflows/release.yml), which builds and publishes the version at that tag in two jobs. The `release` job builds on EC2 (`./bootstrap.sh release`): each architecture pushes its docker images to DockerHub, and the amd64 build stages everything else (the npm tarballs, the playground and the aztec-up installer lock) into the release cache. The `publish` job then runs `./bootstrap.sh publish` on the GitHub runner, which publishes the staged bundle in this order: the aztec-nr crates as a tagged snapshot on the [aztec-nr mirror](https://github.com/aztec-labs-eng/aztec-nr) (which `aztec init` pins), the npm packages to npmjs, the aztec-up and playground assets to S3, and finally the multi-arch docker manifests. npm publishing uses [trusted publishing](https://docs.npmjs.com/trusted-publishers): each `@aztec-labs` package trusts this repository's `release.yml` in the `release` environment, so no npm token exists, and every package carries provenance linking it to the run. A failed publish is retried by re-running the `publish` job, which skips what is already out.

The GitHub release notes of a stable release are written by hand, and their developer part comes from [`CHANGELOG-DEVELOPERS.md`](./CHANGELOG-DEVELOPERS.md) on the branch being released. Before the release is dispatched, run the [`release-changelog`](./.claude/skills/release-changelog/SKILL.md) Claude skill with the version (`/release-changelog 7.0.0`) on that branch, and merge its changes in a PR to it, so the tagged commit carries the version's section the notes are written from, and every entry in both changelogs carries its PR link. A release candidate gets no section: its changes stay under `## Unreleased` until the stable release.

A *private release* publishes the same version to the Labs-owned GCP Artifact Registry instead, and publishes nothing public. It is a manual dispatch of the release tag workflow with `kind=private`, gated by the same second-person approval as an rc, which cuts the tag `private/v<ver>-private.<n>`. That tag triggers the [private release workflow](./.github/workflows/private-release.yml), which runs the same `./bootstrap.sh release` under `RELEASE_TARGET=private`: the `@aztec-foundation` packages it builds against and the `@aztec-labs` packages it publishes both come from and go to the Artifact Registry npm repo, and the docker images go to the Artifact Registry docker repo. The `private/` prefix is part of the ref, not the version: it is what routes the tag to this workflow and to the `release-private` environment, which holds the Artifact Registry credential and nothing that can publish publicly — while the `release` environment holds the npmjs and DockerHub credentials and nothing that can read the Artifact Registry. A job declares one environment, so no run can read from one side and publish to the other. Private releases skip `aztec-up` and `playground`, whose artifacts are public by nature, and build in a cache of their own, which nothing public can read or write, instead of the shared build cache, which is world-readable.
A *private release* publishes the same version to the Labs-owned GCP Artifact Registry instead, and publishes nothing public. It is a manual dispatch of the release tag workflow with `kind=private`, gated by the same second-person approval as an rc, which cuts the tag `private/v<ver>-private.<n>`. That tag triggers the [private release workflow](./.github/workflows/private-release.yml), which runs the same `./bootstrap.sh release` under `RELEASE_TARGET=private`: the `@aztec-foundation` packages it builds against and the `@aztec-labs` packages it publishes both come from and go to the Artifact Registry npm repo, and the docker images go to the Artifact Registry docker repo. The `private/` prefix is part of the ref, not the version: it is what routes the tag to this workflow and to the `release-private` environment, which holds the Artifact Registry credential and nothing that can publish publicly — while the `release` environment holds the DockerHub credentials, the trusted publisher identity npmjs accepts, and nothing that can read the Artifact Registry. A job declares one environment, so no run can read from one side and publish to the other. Private releases skip `aztec-up` and `playground`, whose artifacts are public by nature, and build in a cache of their own, which nothing public can read or write, instead of the shared build cache, which is world-readable.
61 changes: 47 additions & 14 deletions aztec-up/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -280,31 +280,64 @@ function release_preflight {
"$root/yarn-project" "$build_lock" "$version" "$(deps_hash)" "$(dirname "$release_lock")"
}

# Stages the installer for the root `publish`: its files as built (the versions file is generated by
# the build, so is not in the publishing checkout) and the lock release_preflight generated.
function release {
echo_header "aztec-up release"
check_release_lock "$release_lock"
local staged=${RELEASE_DIR:?set by the root release}/aztec-up
if [ ! -f bin/0.0.1/versions ]; then
echo_stderr "No aztec-up/bin/0.0.1/versions. Build aztec-up first."
exit 1
fi
mkdir -p "$staged/bin"
local file
for file in bin/0.0.1/*; do
[[ "$file" == *.tar.gz ]] || cp "$file" "$staged/bin/"
done
cp "$release_lock" "$staged/packages.tar.gz"
}

# <lock>: refuses an installer lock that is not for this release's version.
function check_release_lock {
local version=${REF_NAME#v} lock_version
if [ ! -f "$1" ]; then
echo_stderr "No installer lock at $1. Run release_preflight first."
exit 1
fi
lock_version=$(tar -xzOf "$1" package.json | jq -r .version)
if [ "$lock_version" != "$version" ]; then
echo_stderr "$1 is for $lock_version, not $version. Run release_preflight again."
exit 1
fi
}

# <dir>: uploads the installer `release` staged in <dir> for this release, and moves its aliases.
function publish {
echo_header "aztec-up publish"
local staged=${1:?usage: publish <staged-dir>}
local lock=$staged/packages.tar.gz
local version=${REF_NAME#v}
# e.g. "nightly", or "latest" for bare releases
local dist_tag=$(dist_tag)
# e.g. "4" from v4.1.0-nightly.20260319
local major=$(semver major $REF_NAME)

if [ ! -f "$release_lock" ]; then
echo_stderr "No installer lock at aztec-up/$release_lock. Run release_preflight first."
check_release_lock "$lock"
if [ ! -f "$staged/bin/versions" ]; then
echo_stderr "No installer versions file in $staged/bin: the installer cannot install without it."
exit 1
fi
local lock_version
lock_version=$(tar -xzOf "$release_lock" package.json | jq -r .version)
if [ "$lock_version" != "$version" ]; then
echo_stderr "aztec-up/$release_lock is for $lock_version, not $version. Run release_preflight again."
exit 1
fi
do_or_dryrun aws s3 cp "$release_lock" "s3://install.aztec.network/$version/packages.tar.gz"

# Upload each file in bin/0.0.1/, replacing VERSION= lines with the release version.
for file in bin/0.0.1/*; do
[[ "$file" == *.tar.gz ]] && continue
sed "s/^VERSION=.*/VERSION=$version/" "$file" | \
do_or_dryrun aws s3 cp - "s3://install.aztec.network/$version/$(basename $file)"
do_or_dryrun aws s3 cp "$lock" "s3://install.aztec.network/$version/packages.tar.gz"

# Upload each staged installer file, replacing VERSION= lines with the release version. Through a
# file, not a pipe: a dry run reads no input, so the writer of a pipe would die of SIGPIPE.
local versioned
versioned=$(mktemp -d)
for file in "$staged"/bin/*; do
sed "s/^VERSION=.*/VERSION=$version/" "$file" > "$versioned/$(basename $file)"
do_or_dryrun aws s3 cp "$versioned/$(basename $file)" "s3://install.aztec.network/$version/$(basename $file)"
done

# Update versioned alias (e.g. v4-nightly, v5-latest).
Expand Down
Loading
Loading