chant release workflow
Writes the publish workflow, the job that runs chant release publish for the release a release/** tag names, or a tag release.tag makes (#4168). It is generated the way chant ci workflow writes the tick, with a header naming the command that regenerates it.
chant release workflow| Forge | File |
|---|---|
github | .github/workflows/chant-release.yml |
forgejo | .forgejo/workflows/chant-release.yml |
gitlab | .gitlab/chant-release.yml, which .gitlab-ci.yml includes |
The job checks out the tag and builds what the targets upload. Then it fetches the ci tags and chant/lifecycle and publishes with --yes. It always has the OIDC permission, so what it uploads carries provenance when the token is there. The workspace’s security groups add the rest: supply-chain adds --require-provenance, and verified-releases adds a chant release verify step before the publish. With neither, nothing refuses a run that lacks them.
When the publish signs with Sigstore (release.signing, or supply-chain with an oci or forge target), the jobs download cosign pinned by SHA-256 for the runner’s architecture (linux amd64 or arm64, chosen by uname -m when the job runs, each build checked against its own SHA-256; another architecture fails the step) and set CHANT_COSIGN to it, unless release.workflow sets CHANT_COSIGN itself. With release.signing.kms, the step that runs chant release publish (in a train, chant workspace train publish) gets the variables the KMS’s credentials are in, and with release.signing.key the key’s variable and its password variable, each from the repository’s secret of the same name, and no other step or job gets them; a variable release.workflow.env sets is left to it. That holds for credentials kept as repository secrets. When the job gets its cloud credentials from the forge’s OIDC token through a step of the project’s own, for example one that assumes an AWS role and exports session credentials to the job’s environment, those credentials are in the environment of every step after it, and chant does not scope them. To keep the exposure small, put that step as late as the job allows, give the role only the sign and get-public-key actions on the one key, and keep the session short. Under supply-chain a KMS key or a key signs for any target, so the jobs install cosign then too. On GitLab the file names none of them: a project’s CI/CD variables reach every job, so mark them protected and scope them to the environment the release runs in. On Forgejo, keyless signing needs a private Fulcio (release.signing.fulcio), since public Fulcio issues no certificate for a Forgejo token: with one, the publish job and a dispatched cut job that runs the doctor get enable-openid-connect: true, and without one the command refuses to write the file and names release.signing.kms and key. The same holds for a train’s file.
With release.scan: { schedule: "<cron>" } the command also writes chant-release-scan.yml beside the publish workflow, a scheduled job that runs chant release scan --deployed (.gitlab/chant-release-scan.yml on GitLab, for a pipeline schedule with the same cron expression).
A release.images Dockerfile that starts from bases pinned by digest builds the same image from the same commit. chant release images --repin moves those pins to the digest each tag names today; see Pin image bases by digest.
A release.images entry whose bases come from a registry that needs a login names it under pull, with the variables that hold a username and a password or token:
images: [{ name: "app", dockerfile: "Dockerfile", pull: [{ registry: "cgr.dev", usernameEnv: "CGR_USERNAME", passwordEnv: "CGR_PASSWORD" }] }]The cut and publish jobs then run docker login to each registry before they build, on GitHub, GitLab and Forgejo and in a train’s jobs. On GitHub and Forgejo the jobs read the two variables from the repository’s secrets of the same names, unless release.workflow.env sets them; on GitLab they are the project’s CI/CD variables, which should be masked. The login takes a static username and password, so it works with a registry’s pull token and needs no OIDC federation. On GitHub a base in a private ghcr.io package can be read with the run’s own token: set the password variable to "${{ github.token }}" in release.workflow.env, and the jobs that build the images (the cut, and on a tag the publish job) get packages: read. A short-lived pull token has to be rotated, and the secret updated, before it expires. chant release doctor checks that both variables are set (image-pull-login).
A CI product whose image is built with base: { registry: "cgr.dev/<org>" } (see CI products) pulls both of its bases from that org, so each release.images entry that builds the Chainguard set names cgr.dev under pull. The username and password are a pull token’s, made with chainctl auth pull-token create. On Chainguard’s Starter plan a pull token expires within 30 days, so the secret needs a new token before then. base: "chainguard" takes Chainguard’s public images and needs no login.
When the publish scans before the stage (release.scan, or supply-chain with an oci, forge or npm target), the cut and publish jobs download grype and syft pinned by SHA-256 and set CHANT_GRYPE and CHANT_SYFT to them, unless release.workflow sets either itself. The cut’s doctor checks them, the cut scans with them before it tags the release, and the publish scans with them again. See The scan before the stage.
release.verify runs inside the publish job, as part of chant release publish, so the commands have the toolchains below, the install step’s dependencies and the job’s release.workflow.env.
| Flag | Description |
|---|---|
--forge <forge> | Inferred from the repository’s pipeline files, github when there are none. |
--install <command> | The install step. Default npm ci in a project with a package.json, none otherwise. |
--build <command> | What builds the files the targets upload. Default npm run build when the package.json has a build script, none otherwise. |
--chant <command> | What runs chant. Default npx chant in a project with a package.json; otherwise npx --yes @intentius/chant@<version>, the version that wrote the file. |
--output <file> | Write somewhere else. |
--force | Replace a file at the target that chant did not write. |
A file at the target that chant generated is rewritten. One without chant’s generated-by header, such as a hand-written publish.yml that release.workflow.file names, is refused with release-workflow-exists unless --force, as release init refuses it.
A flag wins over the release.workflow field it names. With no --build and no release.workflow.build, a project whose package.json has no build script, or that has no package.json, gets no build step.
Each job sets up the toolchains the project builds with, found from the files at the project’s root, beside the Node that chant runs on:
| File | Toolchain | Action | Version |
|---|---|---|---|
package.json | node | actions/setup-node | 24 |
go.mod | go | actions/setup-go | go-version-file: go.mod |
pyproject.toml, setup.py, requirements.txt | python | actions/setup-python | .python-version when there is one, otherwise 3.x |
Cargo.toml | rust | actions-rust-lang/setup-rust-toolchain | rust-toolchain.toml when there is one, otherwise stable |
pom.xml, build.gradle, build.gradle.kts | java | actions/setup-java (Temurin) | .java-version, .sdkmanrc or .tool-versions when there is one, otherwise 21 |
Every action is pinned by commit, as in the other workflows chant writes, and none caches, so a release build starts from the commit and the toolchain alone. The gate job, which only runs chant, sets up Node alone. A Go project with no package.json gets Node and Go, no install step and no build step, and runs chant with npx --yes @intentius/chant@<version>. release.workflow.toolchains names them instead (see below). On GitLab a job runs in its runner’s image, which brings the toolchain: the file sets nothing up, chant release workflow says which toolchains the project’s files name, and a toolchains field that names anything but node is refused.
A project with no chant.workspace.json renders its workflow from the chant.config.ts in the current directory, and needs no chant ci setup: with no ci.green its cut is gated on the forge’s checks (see The green gate).
The whole release from the config
Section titled “The whole release from the config”release.workflow in the workspace root’s chant.config.ts renders the rest of the release into the same file (#4656):
release: { workflow: { trigger: "dispatch", gate: "last-green", build: "npm run build", after: ["npm run announce"], }, publish: [/* the targets, as before */],},| Field | Meaning |
|---|---|
trigger | tag (default) publishes on the release’s tag, as above. dispatch starts the release by hand with its label |
gate | For dispatch: last-green (default) cuts the newest green commit at or below the dispatched one; head cuts the dispatched commit and refuses it when it is not green |
install, build, chant | As the flags. install: false installs nothing and build: false builds nothing. The cut runs build as its --build, and so does the publish job |
runner | The runs-on label of the gate, cut, publish and post-release jobs, or a list of labels that must all match. Default ubuntu-latest. Name a runner that has what the jobs need, such as a docker daemon for release.images. A train’s jobs take it too. GitHub and Forgejo; a GitLab job takes its runner from .gitlab-ci.yml, and runner is refused there. The builds name their own |
toolchains | The toolchains the jobs set up, in place of those the files name: "node", "go", "python", "rust", "java", or { name, version } for a version, such as [{ name: "go", version: "1.24" }]. Jobs that run chant get Node as well. false sets up nothing and leaves the runner’s own. GitHub and Forgejo |
builds | Per-platform build jobs for trigger: "dispatch", see Builds on other runners |
after | Shell lines run once the release is published, with CHANT_RELEASE_LABEL set |
permissions | Scopes added to the cut and publish jobs, such as { issues: "read" }. contents and id-token are refused, since chant grants them to the jobs that need them: the publish job has contents: write and id-token: write, and the cut contents: write, plus id-token: write when it runs the doctor for a release that signs. A packages: read reaches the cut too, and does not lower the packages: write a ghcr.io target adds to the publish job. GitHub and Forgejo only (#4751) |
env | Variables for the cut and publish jobs. A forge expression stays in the job’s env: (GitLab: variables:), off every run: line |
setup | Steps the cut and publish jobs run after the install: { run }, or { uses, with } on GitHub and Forgejo, such as a newer npm. GitLab refuses uses |
file | Where the workflow is written, from the repository root, such as .github/workflows/publish.yml when npm’s trusted publisher names that file |
doctor | chant release doctor before anything is published. With trigger: "dispatch" the cut job runs it before the cut, unless doctor: false. With trigger: "tag" the cut already happened, and doctor: true runs it in the publish job before the build |
On GitHub the targets in release.publish add what they need, so the config names none of it (#4786). An oci target on ghcr.io with no usernameEnv or passwordEnv pushes with the run’s token: the workflow gets packages: write, and the cut and publish jobs get OCI_USERNAME: "${{ github.actor }}" and OCI_PASSWORD: "${{ github.token }}". An npm target on npmjs publishes with trusted publishing, which needs npm 11.5.1 or later, so the cut and publish jobs install a newer npm after setup when the runner’s is older. A scope or variable release.workflow sets wins over the one the targets add.
When release.images builds a platform the runner can’t run, such as linux/arm64 on an amd64 runner, the cut and publish jobs set up QEMU’s binfmt handlers for it after the install and before setup (#4876). The platforms are a Dockerfile entry’s platforms (default linux/amd64 and linux/arm64) and a build entry’s platforms. GitHub and Forgejo run docker/setup-qemu-action at chant’s pin with platforms: arm64; GitLab runs docker run --privileged --rm tonistiigi/binfmt:<tag>@sha256:<digest> --install arm64, the image pinned by the digest IMAGE_PINS.binfmt in @intentius/chant/image-pins records (#4941), and chant release workflow notes that the runner’s executor must run privileged containers, or have the handlers installed on its host. A setup that names the action or the binfmt image already gets no second one, and a release whose images build only linux/amd64 gets none. RELEASE_WORKFLOW_QEMU_FLOOR is the first chant that does this.
With trigger: "dispatch" the file has four jobs, and the label is an input of the run (a pipeline variable, CHANT_RELEASE_LABEL, on GitLab):
| Job | What it does |
|---|---|
| gate | chant ci last-green --from <dispatched commit>, honouring release.lane, and hands the commit on. When release.green is forge-checks or none, it hands on the dispatched commit, which the cut then checks. It hands on the label too, computed by release next for auto |
| cut | Checks the commit out, runs chant release doctor (with the run’s GITHUB_TOKEN when a GitHub forge target or forge-checks needs it), then chant release cut <label> --at <commit> --yes, which pushes chant/lifecycle, and pushes the tag the cut made; a cut whose record did not land exits 1 and the tag is not pushed |
| publish | Checks the commit out, builds, and publishes, with the security groups’ --require-provenance and release verify as above |
| after-release | Runs after, when there is any |
The label input takes auto (on GitLab, CHANT_RELEASE_LABEL=auto): the gate fetches chant/lifecycle and runs chant release next --at <commit> at the commit it chose, stops when that refuses, and hands the label on, so every later job, the build jobs among them, sees the computed label in CHANT_RELEASE_LABEL. A label typed in is handed on as it is. On GitLab a pipeline variable outranks the gate’s dotenv, so the gate hands the label on as CHANT_RELEASE_NEXT and each later job exports it as CHANT_RELEASE_LABEL first.
On GitLab the publish job declares SIGSTORE_ID_TOKEN in id_tokens, and PYPI_ID_TOKEN beside it when a pypi target may use trusted publishing: the audience is pypi, or testpypi for a target on TestPyPI. A target with auth: "token", or on another index (uploadUrl), gets none. A nuget target that may use trusted publishing adds NUGET_ID_TOKEN with the audience https://www.nuget.org, unless it sets auth: "token" or pushes to another feed (pushUrl).
No tag exists until the gate has passed and the cut has run. Under forge-checks the cut job gets the run’s token as GITHUB_TOKEN, and on GitHub the workflow gets checks: read and statuses: read, and the cut actions: read, which a private repository needs before it lists the release workflow’s earlier runs on the commit; on GitLab the cut reads pipelines with CHANT_RELEASE_TOKEN unless CHANT_GITLAB_TOKEN is set. On GitLab the jobs follow each other by needs in the default stage, so .gitlab-ci.yml keeps its own stages, and the cut and publish jobs push with CHANT_RELEASE_TOKEN, a project access token with write_repository, since a job token cannot push.
With release.images (see Images the package pins), the publish job runs chant release images <label> after fetching chant/lifecycle and before the build, and exports CHANT_RELEASE_DIGESTS. In a dispatched release the cut job hands the archives it built to the publish job as a workflow artifact (chant-release-images; on GitLab, the cut job’s artifacts:), and the publish job checks them with chant release images <label> --no-build, which reads the archives on disk and refuses one whose digest is not the recorded one. The images published are then the ones the cut built, even when the package mirror an image installs from moved between the two jobs. This holds for either trigger. after with the tag trigger adds an after-release job that follows the publish. A config with only publish renders the file it always did.
The workflow grants contents: read and each job names its own scopes, so the file passes chant audit --fail-on merge-worthy. The gate and the after-release job have contents: read. The cut has contents: write to push the tag, plus checks: read, statuses: read and actions: read under green: "forge-checks", packages: read when permissions asks for packages: read or a pull entry logs in to ghcr.io with the run’s token, and id-token: write when it signs and runs the doctor. The cut never gets packages: write. The publish job has contents: write (the forge release, the floating tag and the ledger) and id-token: write, plus packages: write for an oci target on ghcr.io. Any other scope from permissions goes to the cut and the publish job. A tag-triggered file has the publish job alone, with the publish job’s scopes. A cut job that hands images or files to the publish job uploads a workflow artifact, so its checkout sets persist-credentials: false and keeps no token in .git/config for the upload to pick up. Its git reads the job’s token from the environment instead: CHANT_RELEASE_GIT_TOKEN and a credential helper for the forge’s own host in GIT_CONFIG_COUNT, GIT_CONFIG_KEY_0 and GIT_CONFIG_VALUE_0, which the fetches, the ledger push and the tag push use.
With release.tag (see The release’s tag), the tag trigger runs on the tags the template makes, with {member} and {path} filled in: v{version} runs on v*. A floating tag is left out with a negated pattern (!v[0-9]+), so moving it starts nothing; on GitLab the rule is a regular expression with the same effect. The publish job fetches chant/lifecycle right after the install, reads the label with chant release tag "$GITHUB_REF_NAME" --json, and exits 1 for a tag that names no release of the member. Every later step uses CHANT_RELEASE_LABEL, and the after-release job gets it from the publish job. Under doctor: true the publish job runs chant release doctor once the label is read. A floating tag is pushed by the publish job with git: GitHub and Forgejo jobs can, with contents: write; a GitLab job token can’t, so chant release workflow says so, and a dispatched release on GitLab pushes it with CHANT_RELEASE_TOKEN. A dispatched release pushes whatever tag the cut made. A member with no release.tag renders the release/** file it did.
Building images in a GitLab job
Section titled “Building images in a GitLab job”The GitLab file names no image and no services: each job runs in the image the project’s .gitlab-ci.yml gives it. A job that builds release.images runs docker buildx (the builder is created with docker buildx create --name chant-release --driver docker-container), so on GitLab’s shared runners the project’s default: gives the jobs an image that has the docker CLI and Node, and a docker-in-docker service for the daemon:
include: - local: .gitlab/chant-release.yml
default: image: docker:cli services: - docker:dind before_script: - apk add --no-cache nodejs npm gitWith GitLab’s TLS variables for docker-in-docker (DOCKER_HOST=tcp://docker:2376, DOCKER_TLS_VERIFY=1, DOCKER_CERT_PATH), docker buildx create stops with could not create a builder instance with TLS data loaded from environment. Create a docker context for the service from the certificates, use it, and unset the three variables, in the before_script that runs before the release jobs’ own script:
default: before_script: - docker context create dind --docker "host=$DOCKER_HOST,ca=$DOCKER_CERT_PATH/ca.pem,cert=$DOCKER_CERT_PATH/cert.pem,key=$DOCKER_CERT_PATH/key.pem" - docker context use dind - unset DOCKER_HOST DOCKER_TLS_VERIFY DOCKER_CERT_PATHThe release file needs no change. chant release doctor does not check that docker and buildx can create the builder, so a runner without them first fails at the build, with no release was cut: the build of image "<name>" exited 1.
Starting a release on GitLab
Section titled “Starting a release on GitLab”A dispatched release starts from a pipeline that sets CHANT_RELEASE_LABEL (CHANT_RELEASE_TRAIN or CHANT_RELEASE_LEVELS for a train), from “Run pipeline”, the API or a trigger. GitLab refuses to set a pipeline variable when the project’s minimum role for it is above the user’s, with Insufficient permissions to set pipeline variables, and a project created on gitlab.com has the setting at no_one_allowed. In Settings, CI/CD, Variables, set “Minimum role to use pipeline variables” to the lowest role that may start a release, or set ci_pipeline_variables_minimum_override_role through the project API to developer, maintainer or owner. The release file does not set it.
A release train
Section titled “A release train”In the root of a workspace whose members release separately, such as one member per package of a monorepo, release.train (see chant workspace train cut) makes the workflow release the members as a train rather than the root as one member:
export default { release: { train: { env: "npm" }, workflow: { trigger: "dispatch", file: ".github/workflows/publish.yml", env: { NPM_TOKEN: "${{ secrets.NPM_TOKEN }}" }, }, },};With trigger: "dispatch" it starts by hand with the input levels: auto (the default: each member’s conventional commits and intent files decide), a level for every member, or <member>=<level> pairs separated by spaces. Three jobs follow:
| Job | What it runs |
|---|---|
gate | Picks the commit as a dispatched release does: chant ci last-green, or the dispatched commit under gate: "head" |
cut | chant workspace train cut <env> --at <commit> --levels <levels> --doctor --yes --json: the members release changed lists, each labelled past every version its ledger, tags, packages and npm hold, release doctor in each of them (left out under doctor: false), each cut, the train recorded, and the member tags and release-train/<env>/<id> pushed in one push. A commit with nothing to release ends the run here. A cut whose JSON can’t be read, or names members cut and no train, fails the job rather than skip the publish, and its error names the train id when the output holds one. When a member declares release.images or release.artifacts, chant workspace train artifacts <env> <id> -o <dir> then stages what the cuts built and hands it to the publish job |
publish | In a checkout of the commit: chant workspace train prepare <env> <id> (stamp each member, build the packages they build against), the build, chant workspace train artifacts <env> <id> --from <dir> when a member builds images or files (each checked against its release’s digests), chant workspace train verify <env> <id> under verified-releases, and chant workspace train publish <env> <id> --yes, which stages every member, runs each member’s release.verify, and reveals layer by layer, core first |
The second input, train, finishes a train that was cut and recorded and did not publish, because the publish job stopped part way or never ran. Dispatch the workflow with the train’s id (train-..., as chant workspace train list <env> prints it): the gate and the cut are skipped, nothing is cut or tagged, and the publish job checks out the commit release-train/<env>/<id> names and runs train prepare and train publish for that train. The publish resumes: targets an earlier run staged or revealed are not staged again. The job’s steps come from the workflow file on the branch you dispatch from, while a chant command that runs the repository’s own source (such as npx tsx packages/core/src/cli/main.ts) runs it as of the train’s commit. A step the train’s chant lacks, such as generating sources a member builds against, goes in release.workflow.build, which the job runs after train prepare.
gh workflow run publish.yml -f train=train-0b6d2c1e-5f3a-4c8e-9a7b-2d4e6f8a1c3bThe publish job also runs on a pushed release-train/<env>/* tag, which a train cut from a workstation with chant workspace train cut <env> --yes pushes. With the tag trigger, the default, that job is the whole file. The job’s own token pushes the tags of a dispatched run, and a tag pushed with it starts no workflow, so a dispatched train publishes in its own publish job.
The members’ release.publish targets decide what the jobs need, as a root’s targets do for one release: npm’s trusted publishing setup, packages: write for GHCR, cosign when a member signs, and grype and syft when a member scans. The cut job’s scopes are those of one release’s cut, so when a member signs and the cut runs the doctor it gets the OIDC token the doctor’s signing-oidc check needs: id-token: write on GitHub and Forgejo (with enable-openid-connect: true on Forgejo), and SIGSTORE_ID_TOKEN on GitLab. supply-chain adds --require-provenance to the train publish.
A member that declares release.images or release.artifacts builds them in its cut, in the cut job. The cut job stages them, per member directory, in the workflow artifact chant-release-artifacts, and the publish job copies them back after its build and checks each against the digests its release records, so what the cut built is what publishes. The publish job of a pushed release-train/<env>/* tag, or of a dispatched train, has no cut job to hand it anything, and builds each member’s images and files again from the train’s commit; a build that does not reproduce the recorded digests stops the publish. The jobs set up QEMU for the platforms the members’ images build, and goreleaser (with Go from that member’s go.mod) for a member whose files goreleaser builds. A member with images gets its own recorded digests in CHANT_RELEASE_DIGESTS when its targets publish, so a package it packs can pin them. release.images, release.artifacts and release.workflow.builds at the train’s root are refused: a train releases its members, so each declares its own. Releasing a monorepo walks through the setup.
A member’s builds on other runners
Section titled “A member’s builds on other runners”A member can build on other runners too: its own release.workflow.builds (see Builds on other runners) declares the jobs, and a release.artifacts entry’s builtBy names them, as for one release. The train’s root keeps trigger: "dispatch"; the rest of the member’s release.workflow is not read.
// cli/chant.config.ts, a member of the trainexport default { release: { workflow: { builds: [ { name: "cli-darwin-arm64", runner: "macos-14", build: "go build -o dist/cli-darwin-arm64 ./cmd/cli", outputs: ["dist/cli-darwin-arm64"] }, ], }, artifacts: [{ name: "cli", builtBy: "cli-darwin-arm64", archive: true }], publish: [{ type: "forge", forge: "github", repo: "acme/acme", assets: ["artifact:cli"] }], },};A build job needs its member’s label before the cut, and a train decides its labels inside the cut, so the gate plans the train first. After it picks the commit it runs chant workspace train cut <env> --at <commit> --levels <levels> --plan-only --json, which prints each member the train would cut and its label without cutting anything, and hands each build job the label of its member as CHANT_RELEASE_LABEL. A build job whose member is not in the train is skipped (on GitLab it runs and builds nothing). Each job builds in its member’s directory, after the workflow’s install at the workspace root, or its own install in the member; its outputs are paths in the member. With no toolchains it sets up those the member’s files name, else the workspace root’s.
The cut job waits for every build and runs only when none failed. It unpacks each archive into its member with tar -k before the cut, and cuts with --planned, the members and labels the gate planned: a train that would now cut another member, or a member at another label, because a release or tag landed in between, is refused with train-plan-changed before any check, doctor or cut, and nothing is cut. So the files the build jobs made carry the labels the cut records. Each member’s cut records them as for one release, train artifacts -o stages them with the rest of its files, and the publish job of the same run unpacks the archives into the members again before train prepare. A train whose members build on other runners publishes in the run that cut it: a pushed release-train/<env>/* tag or a dispatched train has no build jobs, and its train artifacts stops at a file it can’t build again. TRAIN_BUILDS_FLOOR is the first chant with --plan-only and --planned.
Build job names are used once across the train, since every member’s builds are jobs of one workflow, and builds in a member needs the root’s trigger: "dispatch".
A release train on GitLab
Section titled “A release train on GitLab”On GitLab the train renders as jobs of .gitlab/chant-release.yml, which .gitlab-ci.yml includes. With trigger: "dispatch", run a pipeline (from “Run pipeline”, the API or a trigger) with the variable CHANT_RELEASE_LEVELS set to auto or the levels. The gate, cut and publish jobs follow; the cut and publish jobs push with CHANT_RELEASE_TOKEN, a project access token with write_repository stored as a masked CI/CD variable, since a job token cannot push. To finish a train that was cut and did not publish, run a pipeline with CHANT_RELEASE_TRAIN set to its id instead: the gate and cut are left out, and the publish job publishes that train from its tag, resuming. A cut job hands the members’ images and files to the publish job as its artifacts:.
The dispatched file has no job on a release-train/<env>/* tag, since the tag its own cut pushes would start a second publish of the same train. A train cut from a workstation is published by running a pipeline with its CHANT_RELEASE_TRAIN. With trigger: "tag" the file is one publish job on that tag, and a pushed tag publishes. The publish job runs in the chant-release resource group, so two publishes never overlap.
Builds on other runners
Section titled “Builds on other runners”release.workflow.builds adds a job per platform that builds on its own runner, such as a native arm64 runner, macOS or Windows, after the gate and before the cut:
release: { workflow: { trigger: "dispatch", builds: [ { name: "linux-arm64", runner: "ubuntu-24.04-arm", build: "go build -o dist/acme-linux-arm64 .", outputs: ["dist/acme-linux-arm64"] }, { name: "darwin-arm64", runner: "macos-15", build: "go build -o dist/acme-darwin-arm64 .", outputs: ["dist/acme-darwin-arm64"] }, { name: "windows-amd64", runner: "windows-latest", build: "go build -o dist/acme.exe .", outputs: ["dist/acme.exe"] }, ], }, publish: [{ type: "forge", forge: "github", repo: "acme/acme", assets: ["dist/acme-linux-arm64", "dist/acme-darwin-arm64", "dist/acme.exe"] }],},| Field | Meaning |
|---|---|
name | The job is build-<name> (chant-release-build-<name> on GitLab): lowercase letters, digits and dashes |
runner | GitHub’s and Forgejo’s runs-on label, or labels; on GitLab, the runner’s tags |
build | Run with bash from the project root, with CHANT_RELEASE_LABEL set, so a version can be built in |
outputs | The files the job hands on, from the project root. Shell globs such as dist/acme-* are allowed; a path with .. or a leading / is refused |
install | The install before the build. Default the workflow’s; false for none |
toolchains | In place of the workflow’s toolchains, as above. Node is not added: a build job doesn’t run chant |
env | Variables for this job only |
On GitHub and Forgejo a build job checks out the gate’s commit without the job token’s credentials, reads with contents: read and nothing more, and gets none of the cut and publish jobs’ env, so a build cannot push, mint an OIDC token or read the publish credentials. On GitLab it gets none of the release file’s variables or ID tokens, and the project’s CI/CD variables reach it as they reach any job, so keep publish credentials protected and the release on a protected ref. A build job packs its outputs with tar, which keeps each file’s path and mode, and hands the archive on as a workflow artifact (chant-release-build-<name>; on GitLab, the job’s artifacts:). The cut job waits for every build, so chant release doctor runs there after the builds, with the cut job’s toolchains and credentials; a build job has neither and never runs it. The cut job unpacks each archive into the project root before chant release cut runs, with tar -k, so a build cannot replace a file of the commit and two builds cannot write the same path. The cut then finds the files where its own build would have left them, and a release.artifacts entry with no build (see Files the release builds) records them as they are, so the cut job builds nothing a build job built. The publish job unpacks them too, before the stamp, the images and the build, so the targets upload the files the runners built, under the same signing, provenance and SBOM checks as any other release. Build outputs belong in .gitignore, as for any build, or the publish refuses the tree as changed.
builds needs trigger: "dispatch": with the tag trigger the release was cut before the workflow ran, and chant release workflow refuses it.
With release.artifacts (see Files the release builds), a dispatched release’s cut job stages the files it built with chant release artifacts <label> --no-build -o <dir> and hands them to the publish job as the workflow artifact chant-release-artifacts, from the runner’s temp directory. The publish job downloads them to its temp directory and runs chant release artifacts <label> --from <dir> after the build and before the publish, which puts each file at its path and refuses one whose digest is not the recorded one. On GitLab the cut job keeps them as .chant-release-artifacts/ in its artifacts:, and the publish job moves that directory out of the checkout first. With the tag trigger the publish job runs chant release artifacts <label> after fetching chant/lifecycle, which builds them again and checks them. A goreleaser entry adds two steps to the job that builds: actions/setup-go with the member’s go.mod on GitHub and Forgejo, without a cache, unless the job’s toolchains already set Go up or setup names actions/setup-go, and the goreleaser chant pins, downloaded, checked against its SHA-256 and named by CHANT_GORELEASER, unless release.workflow.env sets CHANT_GORELEASER. A GitLab job uses its image’s Go. An nfpm entry adds the nfpm chant pins to the same job, downloaded, checked against its SHA-256 and named by CHANT_NFPM, unless release.workflow.env sets CHANT_NFPM.
With release.version (see The label as the package version), the publish job runs chant release stamp <label> after the install and the setup steps and before the images and the build, under either trigger. The cut job is unchanged: the cut stamps on its own. A config without release.version renders the file it did.