-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (44 loc) · 1.53 KB
/
release.yml
File metadata and controls
55 lines (44 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
50
51
52
53
54
55
name: Create GitHub Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract release notes from CHANGELOG
id: changelog
run: |
# Extract the section for this version from CHANGELOG.md
version="${GITHUB_REF#refs/tags/v}"
# Extract content between this version header (exclusive) and the
# next version header (exclusive). A single-regex range like
# /A/,/B/ where both patterns can match the same line yields a
# single-line range (the bug that produced empty release notes
# through v0.9.0). Flag-toggle pattern starts AFTER the header.
awk "/^## \[$version\]/{flag=1; next} /^## \[/{flag=0} flag" CHANGELOG.md \
| sed '/^$/d' > release_notes.txt
# Add installation instructions
cat >> release_notes.txt << EOF
## Installation
\`\`\`bash
pip install har-capture==$version
\`\`\`
## Full Changelog
See [CHANGELOG.md](https://github.com/solentlabs/har-capture/blob/v$version/CHANGELOG.md) for complete details.
EOF
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body_path: release_notes.txt
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}