-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (37 loc) · 1.36 KB
/
Copy pathrelease.yml
File metadata and controls
44 lines (37 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: release
# Cut a GitHub Release from a vX.Y.Z tag. The version in
# plugin/.claude-plugin/plugin.json is the single source of truth; this workflow refuses to
# release if the tag and that version disagree, then publishes notes from CHANGELOG.md.
on:
push:
tags: ["v*.*.*"]
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify tag matches plugin.json version
run: |
tag="${GITHUB_REF_NAME#v}"
ver=$(python3 -c "import json; print(json.load(open('plugin/.claude-plugin/plugin.json'))['version'])")
if [ "$tag" != "$ver" ]; then
echo "tag $GITHUB_REF_NAME does not match plugin.json version $ver" >&2
exit 1
fi
- name: Extract release notes from CHANGELOG
run: |
ver="${GITHUB_REF_NAME#v}"
awk -v v="$ver" '
$0 ~ "^## \\[" v "\\]" {grab=1; next}
grab && /^## \[/ {exit}
grab {print}
' CHANGELOG.md > RELEASE_NOTES.md
if [ ! -s RELEASE_NOTES.md ]; then
echo "No CHANGELOG section for $ver." > RELEASE_NOTES.md
fi
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --notes-file RELEASE_NOTES.md