-
Notifications
You must be signed in to change notification settings - Fork 16
50 lines (42 loc) · 1.58 KB
/
release.yml
File metadata and controls
50 lines (42 loc) · 1.58 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
name: 📝Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify tag is on master
run: |
git fetch origin master
if ! git merge-base --is-ancestor "${{ github.sha }}" origin/master; then
echo "::error::Tag is not on master — skipping release"
exit 1
fi
- name: Extract release notes from CHANGELOG
id: changelog
run: |
VERSION="${{ github.ref_name }}"
VERSION_NUMBER="${VERSION#v}"
RELEASE_NOTES=$(awk -v ver="$VERSION_NUMBER" '
$0 ~ "^## \\[?" ver "\\]?([[:space:]]|$)" { found=1; next }
found && /^## / { exit }
found { print }
' CHANGELOG.md | sed '/^[[:space:]]*$/{ /./!d }')
if [ -z "$RELEASE_NOTES" ]; then
RELEASE_NOTES="Release ${VERSION_NUMBER}"
fi
echo "$RELEASE_NOTES" > /tmp/release_notes.md
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ github.ref_name }}"
gh release create "$VERSION" \
--title "$VERSION" \
--notes-file /tmp/release_notes.md