Skip to content

Commit 307ce2d

Browse files
committed
docs(agents): make release procedure explicit for ai agents
rewrite the release section so an ai agent (or any contributor) can follow the exact sequence: bump cargo.toml, wait for ci, draft notes from the commit log, gh release create, watch the publish workflow. includes failure-mode triage so an agent knows when to retry, when to delete and recreate, and when to escalate to a human. adds semver rules specific to this crate (error variants, key newtypes, payload enum) so version bumps are not guesses.
1 parent c967116 commit 307ce2d

1 file changed

Lines changed: 83 additions & 20 deletions

File tree

AGENTS.md

Lines changed: 83 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -294,32 +294,95 @@ the matching Rust file in the same PR.
294294

295295
## Releasing a new version
296296

297+
**AI agents drive the entire release end to end.** When the user asks
298+
for a new version (or asks you to ship a bug fix, etc.), you handle the
299+
version bump, the release notes, and the publish. Do not hand the
300+
release back to the user unless trusted publishing is unconfigured or a
301+
secret is missing.
302+
297303
GitHub releases are the source of truth for changelogs. Do **not** push
298304
tags manually - always create a release through GitHub. The release
299305
publish event triggers `.github/workflows/publish-crate.yml`, which
300306
authenticates with crates.io via OIDC trusted publishing and runs
301307
`cargo publish`.
302308

303-
Procedure:
304-
305-
1. Bump `version` in `Cargo.toml` (follow semver: patch for bug fixes,
306-
minor for backwards-compatible features, major for breaking changes).
307-
2. Commit on `main`: `chore(crate): bump version to X.Y.Z`.
308-
3. Push and wait for CI to be green.
309-
4. Go to https://github.com/tago-io/lora-packet-rs/releases/new
310-
- **Tag**: `vX.Y.Z` (the workflow rejects mismatches with `Cargo.toml`)
311-
- **Title**: `vX.Y.Z`
312-
- **Body**: changelog as markdown bullets (`### Added`, `### Fixed`,
313-
`### Changed`, `### Breaking`, `### Internal` as needed)
314-
- Click **Publish release**.
315-
5. Watch the `Publish Crate` workflow at
316-
https://github.com/tago-io/lora-packet-rs/actions/workflows/publish-crate.yml.
317-
On success, the new version is live at
318-
https://crates.io/crates/lora-packet.
319-
320-
If the publish fails, fix the cause, then re-run the workflow from the
321-
Actions UI (`Re-run all jobs`) - do not delete and recreate the release
322-
unless the tag itself is wrong.
309+
### Agent procedure
310+
311+
```bash
312+
# 1. Confirm main is clean and decide the new version.
313+
git status
314+
git log "v$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)..HEAD" --oneline
315+
# Pick patch / minor / major per semver based on the commits since the
316+
# last tag.
317+
318+
# 2. Bump Cargo.toml version. Use Edit, not sed-in-place, so the change
319+
# is auditable.
320+
# version = "X.Y.Z"
321+
322+
# 3. Commit and push.
323+
git add Cargo.toml
324+
git commit -m "chore(crate): bump version to X.Y.Z"
325+
git push origin main
326+
327+
# 4. Wait for CI to go green before releasing.
328+
gh run watch --exit-status
329+
330+
# 5. Draft release notes from the commit log. Group by:
331+
# ### Added - new public functionality
332+
# ### Changed - behavior changes that are not breaking
333+
# ### Fixed - bug fixes
334+
# ### Breaking - public API changes that require a major bump
335+
# ### Internal - tooling, refactors, docs that users won't notice
336+
# Be terse. One bullet per change. Drop trivial commits (typos,
337+
# formatting). Write in past tense ("Added X", not "Adds X").
338+
339+
# 6. Create the GitHub release. This triggers the publish workflow.
340+
gh release create vX.Y.Z \
341+
--title "vX.Y.Z" \
342+
--target main \
343+
--notes "$(cat <<'EOF'
344+
### Added
345+
- ...
346+
347+
### Fixed
348+
- ...
349+
EOF
350+
)"
351+
352+
# 7. Watch the publish workflow. Fail loudly if it fails.
353+
gh run watch --workflow=publish-crate.yml --exit-status
354+
355+
# 8. Confirm the version is on crates.io.
356+
curl -s https://crates.io/api/v1/crates/lora-packet | \
357+
python3 -c "import sys,json; print(json.load(sys.stdin)['crate']['max_stable_version'])"
358+
```
359+
360+
### If the publish fails
361+
362+
- **Verify step fails** (tag does not match Cargo.toml): the release was
363+
created with the wrong tag. Delete + recreate the release with the
364+
correct tag.
365+
- **Auth step fails**: crates.io trusted publishing is misconfigured.
366+
This is the only case where you must stop and ask the user to fix the
367+
crates.io repo settings.
368+
- **Publish step fails** (network, transient): re-run from
369+
`gh run rerun --failed`.
370+
- **Workflow YAML had a bug** (e.g., the verify step needs a fix): the
371+
re-run uses the workflow YAML from the original release commit and
372+
will still fail. Fix the YAML, push, **then delete and recreate the
373+
release** so the new release event picks up the fixed YAML.
374+
375+
### Semver rules for this crate
376+
377+
- `Error` variants are public API. Adding a variant is non-breaking
378+
(a minor bump); removing or renaming one is breaking (major bump).
379+
- Key newtypes, the `Payload` enum variants, and the `LoraPacketBuilder`
380+
method signatures are public API. Same rule.
381+
- Adding a feature flag is non-breaking. Removing or renaming one is
382+
breaking.
383+
- Bumping a dependency's major version is breaking if the dep type
384+
shows up in the public surface (none of ours currently do, so this is
385+
usually a minor bump).
323386

324387
## Integration guide
325388

0 commit comments

Comments
 (0)