-
Notifications
You must be signed in to change notification settings - Fork 3
43 lines (38 loc) · 1.21 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
40
41
42
43
name: Create release note.
on:
push:
tags:
- "*"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Extract tag name
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF##*/v}" >> $GITHUB_ENV
- name: Extract release notes
id: release_notes
run: |
RELEASE_NOTES="## Version ""$RELEASE_VERSION"$'\n'
CURRENT_LINE=0
while IFS= read -r line; do
if [[ "$line" == "## [$RELEASE_VERSION] - "* ]]; then
CURRENT_LINE=1
elif [[ "$CURRENT_LINE" == 1 && "$line" == "## ["* ]]; then
CURRENT_LINE=0
elif [[ "$CURRENT_LINE" == 1 ]]; then
RELEASE_NOTES="$RELEASE_NOTES"$'\n'"$line"
fi
done < "CHANGELOG.md"
echo "$RELEASE_NOTES" > release_notes_diff.txt
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.RELEASE_VERSION }}
name: v${{ env.RELEASE_VERSION }}
body_path: ${{ github.workspace }}/release_notes_diff.txt