Release Engineering
Overview
Releases are automated via scripts/release-manager.sh with GitHub Actions for publishing. The system uses:
- Structured logging with JSON output for CI debugging
- Exit-code validation (no fragile grep patterns)
- Rollback automation for failed releases
- Version sync across Cargo.toml and wasm/package.json
Release Manager
# Validate all gates (tests, clippy, fmt, LOC, dry-run)
scripts/release-manager.sh validate
# Prepare release (version bump, changelog, sync)
scripts/release-manager.sh prepare 0.2.0
# Publish (creates git tag, pushes - triggers GitHub release via CI)
scripts/release-manager.sh publish 0.2.0
# Full pipeline (validate + prepare + publish)
scripts/release-manager.sh full 0.2.0
# CI mode (non-interactive)
scripts/release-manager.sh full 0.2.0 --yes --log release.log
# Dry run (simulate without side effects)
scripts/release-manager.sh full 0.2.0 --dry-run
Validation Gates
The validate command checks:
| Gate | Method |
|---|---|
| Clean workspace | git diff --quiet |
| Correct branch | Must be main |
| Compilation | cargo check --all-targets --all-features |
| Formatting | cargo fmt --check |
| Linting | cargo clippy -- -D warnings |
| Tests | cargo test --all-features |
| Documentation | cargo doc --no-deps |
| Publish dry-run | cargo publish --dry-run |
| LOC limits | All src/*.rs ≤ 500 lines |
| WASM target | cargo check --target wasm32-unknown-unknown |
| Security audit | cargo audit (if installed) |
Documentation Sync
The prepare command automatically updates version references across all documentation:
| File | Updates |
|---|---|
Cargo.toml | version = "X.Y.Z" |
wasm/package.json | "version": "X.Y.Z" |
Cargo.lock | Regenerated via cargo check |
README.md | Status table + install examples |
SECURITY.md | Supported versions table |
book/src/getting-started.md | Install examples |
wasm/README.md | npm install examples |
llms.txt, llms-full.txt | Regenerated via scripts/gen-llms-txt.sh |
CHANGELOG.md | [Unreleased] → [X.Y.Z] |
AGENTS.md | Version references (if present) |
CI Workflows
Release (release.yml)
Triggered by successful completion of the CI workflow on main (and by a
fail-closed manual dispatch). It uses the completed workflow’s head_sha, not
the SHA of a later workflow run:
- validate — Extract version from Cargo.toml, verify CI + gate for the target SHA, ensure the tag exists, validate package assembly
- build-artifacts — Build release binary + WASM, create tarballs
- create-github-release — Upload artifacts, extract changelog notes
- publish-crates — Exchange a GitHub OIDC token for a short-lived crates.io token and publish the nine crates in dependency order
- verify-release — Probe all nine crates.io index paths, both npm packages and every expected release asset
- notify — Report the release verdict with per-job status
release.yml holds no crates.io credential: the token is minted per run by
rust-lang/crates-io-auth-action and expires with it. The publish job lives in this file
because the nine crates.io trusted-publisher configs name release.yml, and crates.io
matches the JWT’s workflow filename against that config (ADR-0107) — the separate
publish-crates.yml that ADR-0104 introduced existed only because this workflow used to be
workflow_run-triggered, an event crates.io refuses. verify-release still probes the nine
index paths independently, so a release whose publish failed or never ran stays red.
npm distribution
The npm package is published by the npm distribution job owned by the release
workflow; there is no separate npm-publish.yml workflow:
- Builds the WASM package via
scripts/build-wasm.sh release-web(the same script and mode CI smoke-tests) - Publishes
@d-o-hub/chaotic_semantic_memoryto npm - Includes npm provenance (
--provenance)
crates.io (publish-crates, a job in release.yml)
The job runs inside the crates.io environment and mints a short-lived token through
crates.io OIDC Trusted Publishing (rust-lang/crates-io-auth-action, no repository
secret). It confirms every crate in the workspace declares the releasing version,
publishes the seven members, then chaotic_semantic_memory, then csm-duckdb, and
finally re-probes the sparse index for all nine and reds the run on any gap. Publishing is
idempotent: a crate already in the index at that version is skipped, so re-dispatching
finishes a partial run.
It lives in this file because the nine crates.io trusted-publisher configs name
release.yml, and crates.io matches the JWT’s workflow filename against that config — a
job in another file is answered with 400 ... Expected workflow filenames: release.yml.
See ADR-0107 for the move and ADR-0104 for the OIDC mechanism, the 30-minute token
lifetime the 25-minute job bound sits under, and the environment choice.
Two ways in, and the difference matters:
gh workflow run release.yml -f tag=v0.3.9 # recovery: publishes for real, idempotently
gh workflow run release.yml # dry run: exchange + packaging, nothing uploaded
The untagged dispatch is the sensor: it performs the OIDC exchange (the only thing that can
prove the configs match) and runs cargo publish --dry-run for every crate, uploading
nothing. A real release omits the dry-run flag.
GitHub Pages (pages.yml)
Triggered by push to main (book/ changes):
- Builds mdBook documentation
- Generates API docs via
cargo doc - Deploys to GitHub Pages
Commit Conventions
| Type | Version Bump | Example |
|---|---|---|
feat | Minor | feat(cli): add export command |
fix | Patch | fix(reservoir): correct spectral radius |
perf | Patch | perf(hyperdim): optimize bundle |
feat!: | Major | feat!: redesign API |
docs, chore, test, ci | No release | — |
Rollback
If a release has issues:
# Automated rollback (deletes tag + GitHub release)
scripts/release-manager.sh rollback 0.2.0
# If already published to crates.io, yank manually:
cargo yank --version 0.2.0 chaotic_semantic_memory
Security
- No long-lived API tokens — crates.io publishes over OIDC Trusted Publishing from the
publish-cratesjob inrelease.yml; no workflow reads aCARGO_REGISTRY_TOKENsecret (ADR-0104, ADR-0107) - Concurrency control — Release and publish workflows use
cancel-in-progress: false - Minimal permissions —
release.ymldeclarescontents: readat the top level, each publishing job widens it only where it must, andpublish-cratesasks for exactlycontents: read+id-token: write - Branch protection —
mainbranch requires PR with passing CI - Provenance — npm packages include build provenance attestation
- Audit —
cargo auditruns as part of validation (when installed)