Skip to content

Commit ba116a3

Browse files
stedrewclaude
andauthored
chore: add bump-and-release workflow (#30)
Adds a manually triggered workflow that bumps the version in pyproject.toml, commits, creates an annotated tag, and pushes — reducing a release to a single step via the GitHub UI or CLI. Closes #29 Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e0499b9 commit ba116a3

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Bump and Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version to release (semver, e.g. 1.2.3)"
8+
required: true
9+
10+
permissions:
11+
contents: write # push commit + tag → triggers release.yml
12+
13+
jobs:
14+
bump-and-tag:
15+
name: Bump version, tag, and push
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0 # full history so tag checks are accurate
22+
23+
- name: Validate semver format
24+
run: |
25+
if ! echo "${{ inputs.version }}" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
26+
echo "::error::Version must be semver (e.g. 1.2.3). Got: ${{ inputs.version }}"
27+
exit 1
28+
fi
29+
30+
- name: Fail if tag already exists
31+
run: |
32+
if git tag | grep -q "^v${{ inputs.version }}$"; then
33+
echo "::error::Tag v${{ inputs.version }} already exists."
34+
exit 1
35+
fi
36+
37+
- name: Bump version in pyproject.toml
38+
run: |
39+
sed -i 's/^version = ".*"/version = "${{ inputs.version }}"/' pyproject.toml
40+
41+
- name: Commit, tag, and push
42+
run: |
43+
git config user.name "github-actions[bot]"
44+
git config user.email "github-actions[bot]@users.noreply.github.com"
45+
git add pyproject.toml
46+
git commit -m "chore: bump version to ${{ inputs.version }}"
47+
git tag -a "v${{ inputs.version }}" -m "Release v${{ inputs.version }}"
48+
git push origin main --follow-tags

0 commit comments

Comments
 (0)