Repository navigation
49 lines (41 loc) · 1.53 KB
/
Copy pathrelease.yml
File metadata and controls
49 lines (41 loc) · 1.53 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
name: Release
on:
push:
tags: [ 'v*' ]
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract changelog section
id: changelog
run: |
# Match the version as a whole token: the heading carries a date after it
# ("## v0.1.0 - 09-22-2026"), so this cannot compare the whole line, and a
# bare prefix would hand v0.1.0's release the notes from v0.1.0-rc1.
# "### " subheadings are body - only a "## " heading ends the section.
VERSION_ESCAPED=$(echo "$GITHUB_REF_NAME" | sed 's/\./\\./g')
awk "/^## ${VERSION_ESCAPED}([[:space:]]|\$)/ { p = 1; next }
/^## / { if (p) exit }
p" CHANGELOG.md | sed -e '/./,$!d' > release_notes.md
# An empty slice would otherwise publish an empty release, and only be
# noticed after the tag is pushed.
if ! grep -q '[^[:space:]]' release_notes.md; then
echo "::error::No CHANGELOG.md section for $GITHUB_REF_NAME" >&2
exit 1
fi
echo "Release notes:"; cat release_notes.md
- name: Package headers
run: |
zip -r slick-perfmon-${GITHUB_REF_NAME}.zip include/ LICENSE README.md
tar czf slick-perfmon-${GITHUB_REF_NAME}.tar.gz include/ LICENSE README.md
- name: Publish draft release
uses: softprops/action-gh-release@v1
with:
draft: true
body_path: release_notes.md
files: |
slick-perfmon-*.zip
slick-perfmon-*.tar.gz