-
Notifications
You must be signed in to change notification settings - Fork 12
69 lines (58 loc) · 1.84 KB
/
git-release.yml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
on:
workflow_dispatch:
push:
branches: [master]
paths:
- 'VERSION'
env:
CHANGELOG_FILE: CHANGELOG.md
VERSION_FILE: VERSION
name: Create Release
jobs:
create-git-release:
runs-on: ubuntu-latest
outputs:
release-tag: v${{ steps.get-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Extract latest section from CHANGELOG.md
id: parse-changelog
run: |
i=0
header_start=-1
release_message=""
while read p; do
if [[ $p == \#\#\ * ]]
then
if [[ $header_start -gt -1 ]]
then
break
fi
header_start=$i
fi
if [[ $header_start -gt -1 ]]
then
release_message="$release_message\n$p"
fi
((i=i+1))
done < $CHANGELOG_FILE
echo "::set-output name=latestSection::$release_message"
echo "$release_message"
- id: get-version
run: echo "::set-output name=version::$(cat $VERSION_FILE)"
- name: Unescape special characters
run: printf "${{ steps.parse-changelog.outputs.latestSection }}" > unescaped-release-notes.md
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.get-version.outputs.version }}
release_name: v${{ steps.get-version.outputs.version }}
body_path: unescaped-release-notes.md
release-sbom:
needs: create-git-release
uses: circlefin/circle-public-github-workflows/.github/workflows/attach-release-assets.yaml@v1
with:
release_tag: ${{ needs.create-git-release.outputs.release-tag }}