-
Notifications
You must be signed in to change notification settings - Fork 42
39 lines (34 loc) · 1.01 KB
/
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
name: Create GitHub Release
on:
push:
tags:
- 'v*.*.*'
jobs:
create_release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Extract version from tag
id: extract_version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Read release notes
id: release_notes
run: |
VERSION=${{ env.VERSION }}
CHANGELOG=$(sed -n "/## $VERSION/,/^## /p" CHANGELOG.md | sed '$d')
if [ -z "$CHANGELOG" ]; then
echo "Release notes not found for version $VERSION"
exit 1
fi
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
body: ${{ env.RELEASE_NOTES }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}