AGENTS.md is a 77-line index (the file itself states the <=100-line rule): quick commands, layout, the hard invariants that keep the daemon a router rather than an agent runtime, and pointers into docs/ and .agents/skills/. The release skill turns docs/releasing.md into a runbook plus a checkable artifact: scripts/verify-release.sh asserts the registry version, the SLSA provenance attestation, a clean install from the public registry, the tarball contents, a booting daemon serving / and a healthy /api/v1/health, and the GitHub release. Verified against the live 0.1.2 publish.
5.3 KiB
5.3 KiB
name, description
| name | description |
|---|---|
| release | Cut and verify a pi2d release — pick the version, tag it, let GitHub Actions publish to npm through Trusted Publishing (OIDC), then verify the registry artifact, provenance, a clean install and a booting daemon. Use when asked to "release", "publish", "cut a version", "bump the version", or to diagnose a failed release run. |
Release pi2d
Runbook. Architecture and house rules live in AGENTS.md; the npmjs.com checklist, provenance
rationale and the long troubleshooting table live in ../../../docs/releasing.md. This file is the
procedure to execute.
Non-negotiables
- Publish only from CI. Tag →
.github/workflows/release.yml→ OIDC. A localnpm publishis the one-time bootstrap only (see below), never the steady state. - No tokens. The publish step holds no credentials; the workflow's first guard step fails the
job when
NPM_TOKEN/NODE_AUTH_TOKENis still present in the repo. - Tag ==
package.jsonversion. The workflow verifies the pair and refuses to publish a mismatch. - Push the tag explicitly.
git push --follow-tagsonly pushes annotated tags; a lightweight tag is skipped silently andrelease.ymlnever runs.
Steady-state release
- Preconditions — clean tree on
main, in sync withorigin/main, and CI green on the commit you are about to tag:gh run list --repo zgs225/pi2d --workflow ci.yml --limit 3. - Pick the version with the user (do not assume). Semver: breaking → major, feature → minor,
fix → patch. There is no
CHANGELOG.md; build the notes fromgit log --oneline "$(git describe --tags --abbrev=0)"..HEAD, grouped by conventional type. - Bump and commit:
npm version <x.y.z> --no-git-tag-version git commit -am "chore: release <x.y.z>" - Tag and push (annotated tag, pushed explicitly):
git tag -a "v<x.y.z>" -m "v<x.y.z>" git push origin main git push origin "v<x.y.z>" - Watch the publish:
The interesting steps are
gh run watch "$(gh run list --repo zgs225/pi2d --workflow release.yml --limit 1 \ --json databaseId --jq '.[0].databaseId')" --repo zgs225/pi2d --exit-statusUpgrade npm,Preflight — npm/node support trusted publishing,Publish to npm (trusted publishing, no token)andCreate GitHub release. - Verify the artifact — do not trust a green job, check the registry:
It asserts the exact version is on the registry, the SLSA provenance attestation exists, a clean install from the public registry reports
bash .agents/skills/release/scripts/verify-release.sh <x.y.z>pi2 <x.y.z>, the tarball shipsweb/dist,dist/cli/pi2.jsandLICENSE, the daemon boots and serves/+ a healthy/api/v1/health, and the GitHub release exists. Every line isPASS/FAIL; exit non-zero on any failure. - Report the version, the run URL, the verification output and the release URL. Mention whether
the new version is
latest(a backport is not).
Bootstrap (once per package name, already done for @yuez/pi2d)
Only relevant if the package has left the registry. npmjs.com offers the Trusted Publisher page only for a package that already exists, so the first publish is manual:
- From the repo root:
npm login(accountyuez, 2FA) →npm whoami→npm publish --access public. That artifact has no provenance; every later release does. - Then add the trusted publisher on npmjs.com: owner
zgs225(GitHub), repopi2d, workflow filenamerelease.yml, environment empty, and ticknpm publish(post-2026-09-03 configs allow onlynpm stage publishby default). The first CI publish must happen within 2 days or the configuration expires. - Bump to a higher version for the first CI release — npm rejects republishing a version.
Failure playbook
| Symptom | Cause / action |
|---|---|
No release.yml run after pushing |
The tag never reached the remote. Check gh api repos/zgs225/pi2d/tags --jq '.[].name'; a lightweight tag plus --follow-tags is silent. Push the tag explicitly. |
ENEEDAUTH / "Unable to authenticate" |
OIDC or policy mismatch: workflow filename must be exactly release.yml, npm publish must be ticked under allowed actions, id-token: write must be present, and the trusted publisher must be attached to this package. |
Preflight fails on npm version |
setup-node's node 22 ships npm 10; the Upgrade npm step must run before the preflight. |
Refuse token-based publishing fails |
A NPM_TOKEN/NODE_AUTH_TOKEN repo secret still exists. Delete it — OIDC is the intended path. |
E403 Package name too similar |
Unscoped names hit the registry's similarity filter; this package is scoped as @yuez/pi2d and must stay scoped. |
E403 You cannot publish over the previously published versions |
The version was already published (often the bootstrap). Bump and re-tag. |
Create GitHub release 403 |
Workflow permissions lost contents: write. |
EOTP on a local publish |
Only the bootstrap needs 2FA; pass --otp=<code>. Steady state never publishes locally. |
Definition of done
Registry shows the version with a slsa.dev/provenance attestation, verify-release.sh prints
OK, the GitHub release exists, the working tree is clean, and the report tells the user what to
install (npm i -g @yuez/pi2d@<x.y.z>).