Release Guard — Canonical Release Skill
One workflow. Same for humans and agents. No alternate paths.
Golden path (memorize this)
1. Version + CHANGELOG already on main (via PR)
2. origin/main CI fully green
3. ./scripts/release-manager.sh ship --execute
4. release.yml builds artifacts + creates GitHub Release
5. Optional: ./scripts/release-manager.sh wait-release
| Step | Who | Tool |
|------|-----|------|
| Bump Cargo.toml version + CHANGELOG | Human/agent via PR | PR to main |
| Docs: Released Version = workspace version | Same PR | ROADMAP + STATUS |
| Wait for main CI | Agent | gh run list --branch main --commit $(git rev-parse origin/main) |
| Tag + push only | Agent/human | ./scripts/release-manager.sh ship --execute |
| Build + GitHub Release | GitHub Actions | .github/workflows/release.yml (on tag push) |
| crates.io (if needed) | GitHub Actions | publish-crates.yml (separate) |
NEVER
| Forbidden | Why |
|-----------|-----|
| gh release create by hand | Bypasses cargo-dist / preflight / artifacts |
| Tag from non-main | Policy + dist target |
| Tag when Cargo.toml ≠ tag (v0.1.35 ↔ 0.1.35) | release.yml preflight fails |
| --admin / force merge | main is guarded by ruleset main-protection (not branch protection) for a reason; required_status_checks there are the only checks that unblock a merge |
| Ship while main CI pending/failed | Broken release |
| Ship while an issue or a PR is still open | The tracker is the pre-release contract: unreleased review gets frozen into a published version. scripts/check-release-blockers.sh refuses, and there is no bypass flag — implement or explicitly close the work first |
| Weakening do_ci_check at ship time | The gate is the release's only CI proof; weakening it at ship time is forbidden. Per ADR-083, do_ci_check machine-filters schedule/workflow_dispatch as advisory in code |
| --skip-local-tests without ci-check parity | Skips the local validate/prepare gates; only acceptable when a ci-check on the exact release commit is green (full ship already runs it) |
| Multiple competing “release procedures” | This skill + release-manager.sh only |
Agent checklist (every release)
# 0) Status
./scripts/release-manager.sh status
# 1) Nothing open — merge or explicitly close every PR and every issue.
# `ship` runs this too, and there is no bypass flag.
./scripts/check-release-blockers.sh
# 2) On clean main, synced
git checkout main && git pull --ff-only origin main
test -z "$(git status --porcelain)"
# 3) Version consistency (docs + crates)
./scripts/verify-release-state.sh --check-unreleased # exit 0 (warnings OK)
# 4) Main CI green (also enforced by ship)
./scripts/release-manager.sh ci-check
# 5) Ship (blockers + local quality + CI re-check + tag + push tag)
./scripts/release-manager.sh ship --execute
# 6) Watch release.yml
./scripts/release-manager.sh wait-release
# or: gh run list --workflow=release.yml --limit 3
Dry-run first if unsure:
./scripts/release-manager.sh ship # no --execute → dry-run
Version rules
- Workspace
Cargo.tomlversion = "X.Y.Z"is the source of truth. - Git tag is always
vX.Y.Z(leadingv). - release.yml rejects tag/version mismatch.
- ROADMAP_ACTIVE and STATUS/CURRENT first
Released Versionline must equalX.Y.Zbefore ship (verify-release-state). - CHANGELOG must have exactly one
## [X.Y.Z]section (unique version headers).
Semver for this 0.x line: prefer patch for fixes, minor for features (team convention).
Ship preflight — a version bump alone does NOT make the repo shippable
Before ship reaches Phase 0 it runs ./scripts/check-release-blockers.sh, which refuses while any pull request
or any issue is still open and offers no bypass flag. ship Phase 0 is then
./scripts/verify-release-state.sh --check-unreleased, which validates CHANGELOG.md +
ROADMAP_ACTIVE.md + STATUS/CURRENT.md against workspace_version. A bump-only branch therefore still
fails, and no tag date may be promised until all three agree:
$ ./scripts/verify-release-state.sh --check-unreleased
❌ ROADMAP_ACTIVE.md says v0.1.45 (expected v0.1.46)
❌ STATUS/CURRENT.md references v0.1.45
❌ CHANGELOG.md missing entry for v0.1.46
⚠️ parse-changelog not installed (release notes will fall back)
- Shippable set = version + the
## [X.Y.Z]CHANGELOG heading + the version-doc flip, landed together as
one release-prep PR (chore(release): prepare vX.Y.Z changelog and version docs; precedent #1169) and
green on main before tagging. Queueing the bump PR alone buys nothing — ship stops at Phase 0.
- The
⚠️ parse-changelog not installedline is a silent fallback, not a skipped check: install it
(cargo install --locked parse-changelog — the crate is parse-changelog; **parse-changelog-cli
does not exist**) so release.yml fills the GitHub Release body from CHANGELOG.md.
CHANGELOG / GitHub Release notes (mandatory)
release.yml (cargo-dist) uses parse-changelog to fill the GitHub Release body from CHANGELOG.md. Format must stay consistent with published releases (e.g. v0.1.34 / v0.1.35):
- Unique
## [X.Y.Z] - YYYY-MM-DDheadings — duplicate historical versions make parse-changelog fail and produce an empty release body. - Ship notes under standard Keep a Changelog sections (
### Added,### Fixed, …). - After
wait-release, confirm:gh release view vX.Y.Zshows## Release Notescontent (not blank). - If notes were empty: fix CHANGELOG uniqueness →
gh release edit vX.Y.Z --notes-file …(or re-run notes step); land verify gate (PR #858 pattern) so it cannot regress.
# Pre-ship: changelog must parse for the version being tagged
parse-changelog CHANGELOG.md "$VERSION" >/dev/null
./scripts/verify-release-state.sh --check-unreleased
What `ship` does
check-release-blockers.sh— no open PR and no open issue (auto-maintained
release-drift issue excluded so it cannot deadlock; runs in dry-run too)
verify-release-state.sh --check-unreleased- Local: fmt, clippy, build check, nextest, doctest, quality-gates
(note: quality-gates defaults QUALITY_GATE_SKIP_OPTIONAL=true locally; optional tool gates like coverage/audit run when tools are installed or explicit QUALITY_GATE_SKIP_OPTIONAL=false is set. Skip local checks with --skip-local-tests only in documented emergencies)
ci-checkonorigin/mainHEAD (all runs completed success/skipped)git tag -a vX.Y.Z -m "Release vX.Y.Z"on that HEADcheck-release-blockers.shagain, thengit push origin refs/tags/vX.Y.Zonly (does not push commits) —
the gate re-runs at this chokepoint because prepare + publish is a supported path on its own and the tag
push is the first irreversible act
- Prints how to monitor
release.yml
After ship
- Confirm:
gh release view vX.Y.Z - Mandatory shipped-CLI dogfood before declaring the release complete: download
do-memory-cli from this tag's published assets (never substitute a dev build);
verify its SHA-256 against GitHub's published asset digest and confirm
--version reports the version matching vX.Y.Z; use a fresh temporary
local database. Follow the do-memory-cli-ops cross-process workflow:
create an episode, log successful steps, and complete it.
In fresh processes, use episode view/episode list and pattern list/
pattern search to confirm the completed episode and learned pattern are
database-backed. Require storage stats.patterns.total_count to equal the
nonzero persisted pattern list.total_count. Record the tag, asset digest,
database path, episode ID, and counts. Any mismatch blocks closeout; fix
forward in a new release and repeat dogfooding there (never replace the
immutable tag). Workflow/attestation success is not a substitute.
- The tag workflow publishes draft-first: it creates a draft release, attaches
the dist artifacts plus the CycloneDX SBOMs, generates build-provenance and
SBOM attestations (actions/attest), then publishes. Publishing is what,
once repository immutability is enabled, locks the tag and assets.
- The crates.io chain is dispatched, not release-triggered (LESSON-030):
publishing with the repository GITHUB_TOKEN creates no run for
on: release: published, so release.yml's dispatch-publish job runs
gh workflow run publish-crates.yml --ref vX.Y.Z -f dry-run=false itself.
The publish run's event is therefore workflow_dispatch on the tag SHA —
the absence of a release-event run is not a failed publish.
- crates.io publish authentication is OIDC-only (ADR-078 amendment): each
publish job uses the pinned rust-lang/crates-io-auth-action; there is no
CARGO_REGISTRY_TOKEN secret to rotate. One-time prerequisite per crate:
register a trusted publisher (crate → Settings → Trusted Publishing) with
repository d-o-hub/rust-self-learning-memory, workflow filename
publish-crates.yml, environment crates.io — crates.io matches the calling
workflow and environment only, so restrict that environment to **v* tag
refs** and rely on the workflow's own tag guard (real publishes run only from
tag refs; branch dispatches can only dry-run).
- Verify attestations on a downloaded asset (the digest binding is only
meaningful for the file you actually hold). --signer-workflow is not
optional: without it the default policy checks owner/repo identity only, so
any workflow in the repository that can request an attestation satisfies the
check while the prose reads as though the artifact were pinned (LESSON-034):
```bash
for app in do-memory-cli do-memory-mcp do-memory-examples; do
gh attestation verify ${app}-x86_64-unknown-linux-gnu.tar.xz -R d-o-hub/rust-self-learning-memory \
--signer-workflow d-o-hub/rust-self-learning-memory/.github/workflows/release.yml
gh attestation verify ${app}-x86_64-unknown-linux-gnu.tar.xz -R d-o-hub/rust-self-learning-memory \
--signer-workflow d-o-hub/rust-self-learning-memory/.github/workflows/release.yml \
--predicate-type https://cyclonedx.org/bom
done
gh release verify vX.Y.Z -R d-o-hub/rust-self-learning-memory # immutable releases only
```
- Drift issue (#849-style) should close when tag matches workspace version
- Bump workspace to next patch for development in a follow-up PR (optional)
- A green
publish-crates.ymlis not proof the crates published. Verify each
crate externally after the dispatch finishes, or the workspace ships binaries
while crates.io silently stalls (LESSON-053):
```bash
TAG=vX.Y.Z
for c in do-memory-core do-memory-storage-redb do-memory-storage-turso do-memory-mcp; do
echo "$c: $(curl -sS -H "User-Agent: rust-self-learning-memory-ci" \
"https://crates.io/api/v1/crates/$c/versions" |
jq -r --arg v "${TAG#v}" '[(.versions // [])[].num] | index($v) != null')"
done
# every line must be true; "false" means the publish chain was green but skipped
```
- The chain owns exactly 4 crates (
publish-crates.yml: core → redb → turso → mcp). Ado-memory-cli
404 is by design (it ships as a GitHub Release asset) and do-memory-test-utils is publish = false
(test-utils/Cargo.toml) — neither is a publish failure, so never widen the loop or "fix" the 404. Send a
User-Agent (crates.io rejects the default curl UA with FETCH_FAILED-shaped noise) and test version
membership, not .versions[0].num equality.
- Release is not done until
index("X.Y.Z") != nullfor all 4 andVerify publish landedis green. A
green job whose publish step conclusion was skipped is not a publish — that is how v0.1.45 shipped
while publishing nothing (conclusion=skipped;duration_ms=0). Read step conclusions, never the job verdict.
Failure playbook
| Symptom | Fix |
|---------|-----|
| check-release-blockers.sh refuses (an open PR or issue) | Not a gate bug — close the tracker first: merge each PR through ./scripts/merge-pr.sh <PR> --execute (never --admin) and implement or explicitly close each issue, then re-run. The auto-maintained release-drift issue is excluded by label so the gate cannot deadlock on its own bookkeeping |
| verify-release-state fails docs | PR: set Released Version: vX.Y.Z in ROADMAP + STATUS |
| ci-check pending | Wait; re-run ci-check |
| ci-check failed | Fix main CI first |
| ci-check failed and no push triggered it (a schedule or workflow_dispatch run on HEAD) | Per ADR-083, do_ci_check filters by .event: schedule and workflow_dispatch runs are advisory and non-blocking, while PR/push runs remain mandatory gating checks. If ci-check still fails, read the failing run's event with gh run list --commit $(git rev-parse origin/main) --json event,name,conclusion — a tag-triggered nightly is a push event and does gate, so fix that one on its own merits. |
| Nightly (schedule) run is red and you want it fixed, not just ignored | Advisory runs never block ship (ADR-083), but the debt is still real: gh run list --workflow nightly-tests.yml --limit 10 --json number,event,conclusion and fix the failure on its own merits. Never re-narrow the gate at ship time to hide it (LESSON-051, LESSON-052). |
| Advisory-driven main red (Cargo Deny / Dependency Audit) | Fix main with a lockfile-only PR first; scope from both cargo deny check advisories and cargo audit --json — one tool green does not mean main green (LESSON-046/047) |
| Check for unreleased changes red on the version PR | Cadence is critical; the PR needs release-preparation. If the bot already applied it, gh run rerun replays the label-less payload — toggle the label as a human: gh pr edit <n> --remove-label release-preparation && gh pr edit <n> --add-label release-preparation (LESSON-049). release-preparation is the release PR's own label: applying it to an unrelated PR to force a clean re-run is a deadlock breaker, not a fix — strip it again |
| Everything green but mergeStateStatus stays BLOCKED / the release PR will not merge | strict_required_status_checks_policy makes merges serial: one merge puts every other branch BEHIND and re-queues its required runs, so head SHAs are ephemeral. Merge one PR at a time, re-read gh pr view <n> --json headRefOid,mergeStateStatus immediately before any merge/readiness claim, and batch docs/skills edits into one push (each push restarts the suite; edited does not) |
| Tag already on remote | Do not retag blindly — inspect gh release view first. A tag whose run published nothing (cancelled before host) has no release object, so it is safe to delete on both sides and re-push after the fix lands; a published immutable release is not |
| The tag run's macOS job is cancelled a second after started_at (The configuration 'macos-14-arm64-us-default' is not supported) | A retired runner image, not a workflow bug. GitHub retired macOS 14 on 2026-11-02 and the pinned dist 0.30.4 still defaults aarch64-apple-darwin to it, so the job never gets a runner and host/announce/dispatch-publish all skip. Pin the label in dist-workspace.toml under [dist.github-custom-runners] (arm64 macOS = macos-15, x64 = macos-15-intel), prove it with dist host --steps=create --tag=vX.Y.Z --output-format=json \| jq -r '.ci.github.artifacts_matrix.include[] \| .runner', land it on main, then delete the tag on both sides and re-run ship (LESSON-083) |
| release.yml failed preflight | Version/tag mismatch — delete bad tag only after review |
| Release left unpublished draft (workflow died between draft creation and publish) | Re-run the failed tag workflow run (gh run rerun <id>) — the draft-create step is idempotent and publishing stays inside release.yml; never create a release by hand. This recovery only applies while the release is a draft; a published immutable release cannot be amended (delete it — and the tag, after review — before shipping a corrected one) |
| Attestation missing for an asset | Check the Attest … steps of the tag workflow run; gh attestation verify locally; re-run the run if the step failed |
| GitHub Release body empty / no notes | Duplicate ## [X.Y.Z] in CHANGELOG (parse-changelog fails). Make versions unique; gh release edit to restore notes; keep gate in verify-release-state |
| chore(changelog): update CHANGELOG.md for vX.Y.Z opened by changelog.yml on the tag push | Close, never merge — git-cliff regenerates the file from history, so it replaces the curated entries back to ## [0.1.10] (precedent: #1119/#1105/#1054/#1036 all closed). The changelog is authored by the release-prep PR (LESSON-054) |
| Want crates.io | Use publish workflow / team process after GitHub Release |
Relationship to other skills
| Skill | Use for |
|-------|---------|
| release-guard (this) | All release/tag/publish/deploy requests |
| github-release-best-practices | Background only; defers to this skill |
| pr-readiness | Merging the version-bump PR before ship |
| code-quality | The advisory-bump procedure when main CI is red on Cargo Deny / Dependency Audit |
| release-drift workflow | Alerts when main outruns tags — does not ship |
Commands reference
./scripts/release-manager.sh status
./scripts/check-release-blockers.sh # open PR/issue gate; no bypass flag
./scripts/release-manager.sh validate
./scripts/release-manager.sh ci-check
./scripts/release-manager.sh ship # dry-run
./scripts/release-manager.sh ship --execute # production
./scripts/release-manager.sh wait-release
./scripts/release-manager.sh rollback --tag vX.Y.Z --execute # local tag only
Progressive disclosure
- CI wait patterns: ci-reference.md
- Workflow definition:
.github/workflows/release.yml - Version consistency:
./scripts/verify-release-state.sh - Open-work gate (what
shiprefuses before anything else):./scripts/check-release-blockers.sh