feat: auto-bump patch version on PR merge to main

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Justin Bollinger
2026-02-18 14:58:47 -05:00
co-authored by Claude Opus 4.6
parent c87f498c80
commit 8e30b1fbe2
3 changed files with 48 additions and 1 deletions
+41
View File
@@ -0,0 +1,41 @@
name: version-bump
on:
pull_request:
types: [closed]
branches: [main]
permissions:
contents: write
jobs:
bump:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Bump patch version
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
latest=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+' | head -1)
if [ -z "$latest" ]; then
echo "No version tag found, starting at v0.0.1"
next="v0.0.1"
else
# Strip leading v
version="${latest#v}"
major=$(echo "$version" | cut -d. -f1)
minor=$(echo "$version" | cut -d. -f2)
patch=$(echo "$version" | cut -d. -f3)
patch=${patch:-0}
next="v${major}.${minor}.$((patch + 1))"
fi
echo "Tagging $next (previous: ${latest:-none})"
git tag -a "$next" -m "Release $next"
git push origin "$next"