-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (47 loc) · 1.65 KB
/
Copy pathrelease.yml
File metadata and controls
54 lines (47 loc) · 1.65 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
name: Release
# Auto-create a GitHub Release whenever a version tag (v*) is pushed.
# The release body is the matching section pulled from CHANGELOG.md.
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract release notes from CHANGELOG.md
id: notes
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "Extracting notes for version $VERSION"
# Print lines between the matching '## [VERSION]' heading and the next '## [' heading.
awk -v ver="$VERSION" '
$0 ~ "^## \\[" ver "\\]" {grab=1; next}
grab && /^## \[/ {exit}
grab && /^\[[^]]+\]:[[:space:]]/ {exit}
grab {print}
' CHANGELOG.md > release_notes.md
# Trim leading/trailing blank lines.
sed -i -e '/./,$!d' release_notes.md
awk 'NF{p=NR} {a[NR]=$0} END{for(i=1;i<=p;i++)print a[i]}' release_notes.md > tmp && mv tmp release_notes.md
# Fall back to a generic message if the section is empty.
if [ ! -s release_notes.md ]; then
echo "Release $GITHUB_REF_NAME" > release_notes.md
fi
echo "----- release notes -----"
cat release_notes.md
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "$GITHUB_REF_NAME" \
--title "$GITHUB_REF_NAME" \
--notes-file release_notes.md \
--verify-tag
- name: Validate packaged adapters
run: |
bash scripts/validate.sh