-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (46 loc) · 1.43 KB
/
Copy pathrelease.yml
File metadata and controls
53 lines (46 loc) · 1.43 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
45
46
47
48
49
50
51
52
53
name: Create Release
on:
push:
tags:
- 'v*.*.*'
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
jobs:
release:
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract release notes from CHANGELOG.md
id: changelog
run: |
# Extract section between ## vX.X.X and next ## heading
awk -v ver="${{ github.ref_name }}" '
BEGIN { found = 0 }
/^## / {
if (found) exit
if (index($0, "## " ver) == 1) found = 1
}
found { print }
' CHANGELOG.md > /tmp/release-notes.md
# Get the title from the first line (e.g., "v7.0.0 — May 2026")
HEADING=$(head -1 /tmp/release-notes.md 2>/dev/null)
if [ -z "$HEADING" ]; then
echo "::error::No CHANGELOG.md entry found for ${{ github.ref_name }}. Add one before pushing the tag."
exit 1
fi
TITLE="${HEADING### }"
echo "title=$TITLE" >> "$GITHUB_OUTPUT"
- name: Create Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ github.ref_name }}" \
--title "${{ steps.changelog.outputs.title }}" \
--notes-file /tmp/release-notes.md \
--latest