forked from RonaldHensbergen/composable-data-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (39 loc) · 1.2 KB
/
Copy pathrelease.yml
File metadata and controls
48 lines (39 loc) · 1.2 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
name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Extract changelog section for this tag
run: |
VERSION="${GITHUB_REF_NAME#v}"
if [ ! -f CHANGELOG.md ]; then
echo "_CHANGELOG.md not found. See the commit comparison below._" > release_notes.md
exit 0
fi
ESCAPED_VERSION=$(printf '%s' "$VERSION" | sed 's/\./\\./g')
awk -v ver="$ESCAPED_VERSION" '
BEGIN { found=0 }
/^## \[/ {
if (found) exit
if ($0 ~ "\\[" ver "\\]") { found=1; next }
next
}
found { print }
' CHANGELOG.md > release_notes.md 2>/dev/null
if [ ! -s release_notes.md ]; then
echo "_No CHANGELOG.md entry found for ${GITHUB_REF_NAME}. See the commit comparison below._" > release_notes.md
fi
- name: Create GitHub release
uses: softprops/action-gh-release@v3
with:
body_path: release_notes.md
generate_release_notes: true
draft: true