Skip to content

Commit 8b46f95

Browse files
chore: add release automation and /release skill
- Auto-tag workflow: detects Cargo.toml version bump on main push, creates and pushes git tag to trigger the release workflow. Uses github.event.before for reliable diff, guards against null SHA on first push, and checks remote tags before creating. - /release Claude Code skill: guided release preparation with semver determination, confirmation phase, and PR creation. - CHANGELOG updated with new automation entries. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c28f834 commit 8b46f95

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

.claude/commands/release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Once confirmed:
2828

2929
1. Fetch origin and create a branch: `release/vX.Y.Z` from `origin/main`.
3030
2. Bump version in `Cargo.toml` (the `version = "..."` field under `[package]`).
31-
3. Run `cargo check` to update `Cargo.lock`.
31+
3. Run `cargo check` to ensure the project builds successfully after the version bump.
3232
4. Update `CHANGELOG.md`:
3333
- Move everything under `## [Unreleased]` into a new `## [X.Y.Z] - YYYY-MM-DD` section (use today's date).
3434
- Leave `## [Unreleased]` empty (with just the heading).

.github/workflows/auto-tag.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
with:
15-
fetch-depth: 2
15+
fetch-depth: 0
1616
- name: Check for version bump
1717
id: version
1818
run: |
1919
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/')
20+
if [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ]; then
21+
PREVIOUS="$CURRENT"
22+
else
23+
PREVIOUS=$(git show ${{ github.event.before }}:Cargo.toml | grep '^version' | head -1 | sed 's/.*"\(.*\)"/\1/')
24+
fi
2125
echo "current=$CURRENT" >> "$GITHUB_OUTPUT"
2226
echo "previous=$PREVIOUS" >> "$GITHUB_OUTPUT"
2327
if [ "$CURRENT" != "$PREVIOUS" ]; then
@@ -30,11 +34,22 @@ jobs:
3034
run: |
3135
VERSION="${{ steps.version.outputs.current }}"
3236
TAG="v${VERSION}"
37+
if git ls-remote --tags origin "refs/tags/$TAG" | grep -q .; then
38+
echo "Tag $TAG already exists on origin, skipping"
39+
exit 0
40+
fi
3341
if git rev-parse "$TAG" >/dev/null 2>&1; then
34-
echo "Tag $TAG already exists, skipping"
42+
echo "Tag $TAG already exists locally, skipping"
3543
exit 0
3644
fi
3745
git tag "$TAG"
38-
git push origin "$TAG"
46+
if ! git push origin "$TAG"; then
47+
if git ls-remote --tags origin "refs/tags/$TAG" | grep -q .; then
48+
echo "Tag $TAG was created concurrently on origin, skipping"
49+
exit 0
50+
fi
51+
echo "Failed to push tag $TAG"
52+
exit 1
53+
fi
3954
env:
4055
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)