Skip to content

Commit 9b6616a

Browse files
jmnoteclaude
andcommitted
Add release workflow: auto-create a GitHub Release on version bump
On every push to main, compares extension.json's version field against the previous commit's. If it changed, tags and creates a GitHub Release (vX.Y.Z, with auto-generated notes from merged PRs) for that version — automating what has so far been done by hand after each version bump (matches the existing v0.9.0/v0.10.0/v0.11.0 releases: same tag naming, same --generate-notes-style body). Guards against re-creating a release that already exists (idempotent on workflow re-runs or a version merged more than once). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 59fc0b8 commit 9b6616a

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 2
18+
19+
- name: Check whether extension.json's version changed
20+
id: version
21+
run: |
22+
current=$(jq -r .version extension.json)
23+
previous=$(git show HEAD^:extension.json 2>/dev/null | jq -r .version 2>/dev/null || echo "")
24+
echo "current=$current" >> "$GITHUB_OUTPUT"
25+
if [ "$current" != "$previous" ]; then
26+
echo "changed=true" >> "$GITHUB_OUTPUT"
27+
else
28+
echo "changed=false" >> "$GITHUB_OUTPUT"
29+
fi
30+
31+
- name: Create GitHub release
32+
if: steps.version.outputs.changed == 'true'
33+
env:
34+
GH_TOKEN: ${{ github.token }}
35+
TAG: v${{ steps.version.outputs.current }}
36+
run: |
37+
if gh release view "$TAG" >/dev/null 2>&1; then
38+
echo "Release $TAG already exists, skipping."
39+
exit 0
40+
fi
41+
gh release create "$TAG" --title "$TAG" --generate-notes

0 commit comments

Comments
 (0)