Getting started¶
This page takes a repository from nothing to its first release. It uses a
small Rust workspace as the example: one library crate, onto, and one CLI
crate, onto-cli, both on crates.io, plus the CLI's binaries on a GitHub
release.
You need Python 3.11 or newer, git and PyYAML (pip install pyyaml) on your
machine. release.py tag also uses the GitHub CLI
(gh) to follow the release run; install it and run gh auth login first.
1. Install the copy¶
rab, the Release Asset Bundle, is a public repository. Clone it next to your
repository, then run install from your repository's root:
git clone https://github.com/buchochelliq-labs/release-asset-bundle ../release-asset-bundle
cd your-repository
python3 ../release-asset-bundle/scripts/release.py install
install writes:
| Path | What it is |
|---|---|
.github/rab/scripts/release.py |
the driver script |
.github/rab/<action>/action.yml |
the composite actions: build, gate, plan, publish-crates, publish-github, publish-npm, publish-pypi, publish-vscode |
.github/rab/publish-pypi/requirements.txt |
what publish-pypi installs to upload (twine, pypi-attestations), every hash pinned |
.github/rab/README.md |
a notice: do not edit, reinstall instead |
.github/rab/manifest.json |
the kit's version and commit, and a SHA-256 checksum of every installed file |
.github/rab/estate/release_mode_step.sh |
the release-mode step a package's publish.yml embeds, for estate releases |
.github/workflows/rab-build.yml |
the reusable build workflow |
.github/workflows/release.yml |
the starter release workflow, only if the repository has none |
.github/dependabot.yml |
edited (or, if there is none, written) so Dependabot leaves the installed copy alone: see Updating rab |
Why a copy, and not uses: buchochelliq-labs/release-asset-bundle/gate@v2? A
copy is pinned and reviewable. Your repository runs exactly the code in its own
history, a reviewer sees every line of it, and it changes only when someone
installs again and opens a PR. install --into DIR installs into another
directory instead of the repository you are in.
To update later: git -C ../release-asset-bundle pull, run install again,
and open a PR. That replaces .github/rab/ (files the new version dropped
are removed) and the build workflow, and leaves your release.yml alone.
See Updating rab.
Coming from release-kit 1.x?
install migrates the old layout (release-kit.yml,
.github/release-kit/, release-kit-build.yml) to the new names. See
Migrating from release-kit 1.x.
2. Write rab.yml¶
At the repository root. List every package, in publication order: each after the listed packages of the same registry it depends on.
release:
name_from: onto-cli # the release is named by onto-cli's version
packages:
- name: onto
registry: crates.io
manifest: crates/onto/Cargo.toml
version: "0.1.0"
- name: onto-cli
registry: crates.io
manifest: crates/onto-cli/Cargo.toml
version: "0.1.0"
- name: onto-cli-binaries # a GitHub package's name is free
registry: github
manifest: crates/onto-cli/Cargo.toml
version: "0.1.0"
tag: "onto-cli-bin-v{version}"
artifacts:
- kind: rust-binary
bin: onto
crate: onto-cli
include: [README.md, LICENSE]
Then check it:
python3 .github/rab/scripts/release.py check
rab.yml matches the repository (release 0.1.0).
Quote every version. YAML reads 0.10 as the number 0.1, so rab
refuses an unquoted version. See the rab.yml reference
for every field.
3. Wire release.yml¶
install wrote .github/workflows/release.yml from the template. It is your
file: edit it. Two things usually need attention.
Delete the publish jobs you do not use. The template has
publish-github, publish-crates, publish-pypi, publish-npm and
publish-vscode. Each runs only when the gate selects a package of its
registry, so unused jobs are harmless, but they name environments and secrets
you would otherwise have to explain.
Make your CI callable. The release run calls your .github/workflows/ci.yml
on the tagged commit:
ci:
needs: gate
uses: ./.github/workflows/ci.yml
with:
ref: ${{ needs.gate.outputs.sha }}
So ci.yml needs a workflow_call trigger with a ref input, and must check
that ref out:
on:
push:
branches: [main]
pull_request:
workflow_call:
inputs:
ref:
type: string
required: false
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.ref }} # empty on push and pull_request: the default
persist-credentials: false
# ...
If your CI file has another name, change uses: in the ci job. If its input
has another name (rs-rich-cli's is checkout_ref), change ref: under with:
to that name.
Edit the trigger if you change the release tag. The template starts on
tags matching release-*. If you set release: tag: to another format, change
on: push: tags: to match it.
4. Check the copy in CI¶
Add these steps to a job in ci.yml:
- run: python3 -m pip install --quiet pyyaml
- run: python3 .github/rab/scripts/release.py check
- run: python3 .github/rab/scripts/release.py vendored
check fails when rab.yml disagrees with a manifest, or when
crates.io would refuse a crate (Publishing to crates.io). vendored
fails when anyone edits, deletes or adds a file in the installed copy, so the
copy changes only by installing again.
Dependabot
install keeps your repository's Dependabot off the installed copy, and
check warns when a configuration would still scan it. See
Updating rab.
5. Set up each registry once¶
| Registry | Credential | Set up once |
|---|---|---|
| GitHub Releases | the job's github.token, with contents: write |
nothing |
| crates.io | Trusted Publishing; a crate's first version uses a token | a crates-io environment; a CARGO_REGISTRY_TOKEN secret in it for new crates; a Trusted Publisher on each crate |
| PyPI | Trusted Publishing | a pypi environment; a (pending) trusted publisher on PyPI |
| npm | Trusted Publishing (npm 11.5+), or a token | an npm environment; a trusted publisher on npmjs.com |
| VS Code Marketplace | VSCE_PAT (and OVSX_PAT for a package with open-vsx: true) |
both secrets in a vscode-marketplace environment |
Trusted publishers name the workflow file release.yml and the environment.
Keep both names, or change the publisher settings to match.
6. Commit, merge, release¶
Commit the copy, rab.yml, release.yml and the CI changes in a PR,
and merge it. Then, on the default branch:
git switch main && git pull
python3 .github/rab/scripts/release.py status
python3 .github/rab/scripts/release.py tag --dry-run
python3 .github/rab/scripts/release.py tag
tag pushes the tags, then waits until the run has published everything
(up to three hours by default). See Commands.
For each later release: bump the versions in the manifests, run sync to copy
them into rab.yml, merge the PR, and run tag again.
Updating rab¶
The installed copy pins things: the actions its action.yml files and
rab-build.yml use (each to a commit), and what publish-pypi installs
(publish-pypi/requirements.txt, every hash pinned). Those pins are updated
in rab, by rab's own Dependabot, and reach your repository when you install
a newer rab. A Dependabot PR against .github/rab/ in your repository could
never pass: vendored refuses any edit to the copy.
Dependabot stays off the copy¶
install edits .github/dependabot.yml (or .github/dependabot.yaml) line by
line, keeping comments and the other entries, and adds Dependabot's
exclude-paths to the entries of the three ecosystems that can read a file of
the copy:
| Ecosystem | Reads | install adds to exclude-paths |
|---|---|---|
github-actions |
.github/workflows/ (so rab-build.yml), and the copy's action.yml files when a directories glob reaches them |
.github/rab/**, .github/workflows/rab-build.yml |
pip |
publish-pypi/requirements.txt, when a directory or glob reaches it |
.github/rab/** |
npm |
deploy-site/package.json and package-lock.json (the wrangler deploy-site installs), when a directory or glob reaches them |
.github/rab/** |
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
exclude-paths: # rab's installed copy changes only by reinstalling (release.py install)
- ".github/rab/**"
- ".github/workflows/rab-build.yml"
GitHub's options reference reads exclude-paths relative to the entry's
directory, while its 2025 changelog says relative to the repository root.
install writes patterns that hold either way: the root-relative ones above,
and for an entry whose directory contains them, the same made relative to it
(directory: /.github also gets rab/**).
Other ecosystems (cargo, npm, docker, ...) read nothing rab installs
and are left as they are. Installing again changes nothing once the paths are
there. Where exclude-paths cannot help, install says what to do:
- an entry that names a directory inside the copy (
directory: /.github/rab/publish-pypi, or/.github/rab/gateindirectories) is there only to scan it.installdrops such a directory from adirectorieslist that names others, and otherwise asks you to remove it; - a
directoriesglob that reaches into the copy (/**,/.github/**): each directory it matches would need its own pattern, so list the directories instead; - an entry written in flow style (
- {package-ecosystem: pip, ...}) cannot take a new line, and anexclude-pathsthat is a YAML anchor or alias is shared with other entries: add the paths by hand.installnever writes a file that would not parse.
A repository with no Dependabot configuration gets a minimal one, with a
weekly entry for each such ecosystem its own files are in (github-actions
for its workflows, which release.yml always is; pip for a
requirements*.txt, pyproject.toml, setup.py, setup.cfg or Pipfile at
the root; npm for a package.json at
the root), each excluding the copy. Keep it, or edit it as your own.
check warns (it does not fail) when the configuration would scan the copy:
an entry of those ecosystems without the paths, or one naming a directory
inside it. Pull requests Dependabot already opened against .github/rab/ can
be closed: reinstalling brings the same update.
Knowing a newer rab is out¶
status starts with a line about the installed copy, from two requests to
GitHub's REST API (no token needed; GH_TOKEN or GITHUB_TOKEN, when set,
raises the rate limit):
rab v2.3.0 installed; v2.4.0 is the latest release: install it again from a checkout of v2.4.0 (git -C ../release-asset-bundle checkout v2.4.0, then release.py install)
files that differ from v2.4.0:
.github/rab/publish-pypi/requirements.txt
.github/workflows/rab-build.yml
The files are those of the copy that differ from the latest release's (or are
new in it, or gone from it). status --offline (or RAB_OFFLINE=1) asks
nothing, and when GitHub does not answer the line says so and the rest of
status runs as before.
One pull request per rab release¶
templates/rab-update.yml is an optional workflow: copy it to
.github/workflows/. Once a week it installs rab's latest release on a branch
rab-update/vX.Y.Z, checks it with vendored, and opens one pull request,
once per release. It needs the repository setting Allow GitHub Actions to
create and approve pull requests. A pull request opened with the job's own
token starts no workflows: close and reopen it to run CI, or give the job a
GitHub App token.
Updating rab's own pins (maintainers)¶
rab's .github/dependabot.yml lists every directory with an action.yml, the
build workflow, the template and CI (github-actions), and publish-pypi
(pip). A test checks that every action and hashed requirements file is
listed, and that publish-pypi/requirements.in and requirements.txt pin
the same versions. When a Dependabot PR changes only one of them, compile the
lock again with the command in its header, moving --exclude-newer to today:
uv pip compile publish-pypi/requirements.in --universal --generate-hashes \
--python-version 3.11 --exclude-newer YYYY-MM-DD -o publish-pypi/requirements.txt