-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (29 loc) · 903 Bytes
/
Copy pathrelease.yml
File metadata and controls
32 lines (29 loc) · 903 Bytes
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
name: release
# Turn an annotated vX.Y.Z tag into a GitHub Release, using that version's
# CHANGELOG.md section as the release notes. Fires after `git push --tags`.
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Extract changelog section
run: |
version="${GITHUB_REF_NAME#v}"
awk -v v="$version" '
$0 ~ "^## \\[" v "\\]" { flag = 1; next }
flag && /^## \[/ { exit }
flag { print }
' CHANGELOG.md > release-notes.md
if [ ! -s release-notes.md ]; then
echo "Release ${GITHUB_REF_NAME}" > release-notes.md
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
name: ${{ github.ref_name }}
body_path: release-notes.md