Skip to content

Commit a005a14

Browse files
chore: add release automation and /release skill
- Auto-tag workflow: detects Cargo.toml version bump on main push, creates git tag automatically, which triggers the release workflow. - /release Claude Code skill: guided release preparation with semver determination, user confirmation, and PR creation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 35ccfdb commit a005a14

3 files changed

Lines changed: 85 additions & 0 deletions

File tree

.claude/commands/release.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Release
2+
3+
Prepare a release PR for initium. This command handles version bumping, changelog updates, and PR creation. The release is published automatically when the PR merges (CI detects the version bump and creates the tag, which triggers the release workflow).
4+
5+
## Determine the next version number
6+
7+
Follow semantic versioning (MAJOR.MINOR.PATCH):
8+
9+
1. Read `CHANGELOG.md` under `## [Unreleased]` to see what has changed since the last release.
10+
2. Read recent commits since the last tag: `git log $(git describe --tags --abbrev=0)..HEAD --oneline`
11+
3. Determine the version bump:
12+
- **PATCH** (x.y.Z): Only bug fixes, documentation, or internal changes with no user-facing behavior change.
13+
- **MINOR** (x.Y.0): New features, new CLI flags, new configuration options, or backward-compatible enhancements.
14+
- **MAJOR** (X.0.0): Breaking changes — removed features, changed defaults, incompatible schema/config changes, or renamed CLI flags.
15+
4. Read the current version from `Cargo.toml` and compute the next version.
16+
17+
## Confirmation phase
18+
19+
Before making any changes, present to the user:
20+
- The **current version** and the **proposed next version** with reasoning.
21+
- A **summary of changes** that will go into the release (from Unreleased changelog + commit log).
22+
- Ask: "Proceed with version X.Y.Z?" and wait for confirmation.
23+
- If the user suggests a different version, use that instead.
24+
25+
## Execute the release
26+
27+
Once confirmed:
28+
29+
1. Fetch origin and create a branch: `release/vX.Y.Z` from `origin/main`.
30+
2. Bump version in `Cargo.toml` (the `version = "..."` field under `[package]`).
31+
3. Run `cargo check` to update `Cargo.lock`.
32+
4. Update `CHANGELOG.md`:
33+
- Move everything under `## [Unreleased]` into a new `## [X.Y.Z] - YYYY-MM-DD` section (use today's date).
34+
- Leave `## [Unreleased]` empty (with just the heading).
35+
5. Run `cargo test` to verify nothing is broken.
36+
6. Run `cargo clippy -- -D warnings` and `cargo fmt -- --check`.
37+
7. Commit: `release: vX.Y.Z`
38+
8. Push the branch and create a PR with title `release: vX.Y.Z`.
39+
9. The PR body should include the changelog entries for this version.
40+
41+
When the PR merges, the auto-tag workflow detects the version bump in `Cargo.toml` and creates the `vX.Y.Z` tag, which triggers the release workflow (Docker build + crates.io publish).

.github/workflows/auto-tag.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Auto Tag
2+
on:
3+
push:
4+
branches: [main]
5+
paths:
6+
- Cargo.toml
7+
permissions:
8+
contents: write
9+
jobs:
10+
tag:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 2
16+
- name: Check for version bump
17+
id: version
18+
run: |
19+
CURRENT=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/')
20+
PREVIOUS=$(git show HEAD~1:Cargo.toml | grep '^version' | head -1 | sed 's/.*"\(.*\)"/\1/')
21+
echo "current=$CURRENT" >> "$GITHUB_OUTPUT"
22+
echo "previous=$PREVIOUS" >> "$GITHUB_OUTPUT"
23+
if [ "$CURRENT" != "$PREVIOUS" ]; then
24+
echo "changed=true" >> "$GITHUB_OUTPUT"
25+
else
26+
echo "changed=false" >> "$GITHUB_OUTPUT"
27+
fi
28+
- name: Create and push tag
29+
if: steps.version.outputs.changed == 'true'
30+
run: |
31+
VERSION="${{ steps.version.outputs.current }}"
32+
TAG="v${VERSION}"
33+
if git rev-parse "$TAG" >/dev/null 2>&1; then
34+
echo "Tag $TAG already exists, skipping"
35+
exit 0
36+
fi
37+
git tag "$TAG"
38+
git push origin "$TAG"
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
- Auto-tag workflow: CI automatically creates a git tag when `Cargo.toml` version changes on main, triggering the release workflow.
12+
- `/release` skill for Claude Code: guided release preparation with version determination, confirmation, and PR creation.
13+
1014
## [1.2.0] - 2026-03-11
1115

1216
### Added

0 commit comments

Comments
 (0)