Skip to content

Commit 46c43f4

Browse files
committed
Add GitHub release workflow
1 parent a3ad270 commit 46c43f4

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/github-release.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Source: https://github.com/panubo/reference-github-actions/blob/master/github-release.yml
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
name: GitHub Release
9+
10+
jobs:
11+
build:
12+
name: Create GitHub Release
13+
runs-on: ubuntu-latest
14+
steps:
15+
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Get Release Notes
22+
id: get_release_notes
23+
run: |
24+
NOTES=$(git log --pretty=format:%s $(git tag --sort=-refname | head -1)...$(git tag --sort=-refname | head -2 | tail -1) | awk '{ print "-", $0 }')
25+
NOTES="${NOTES//'%'/'%25'}"
26+
NOTES="${NOTES//$'\n'/'%0A'}"
27+
NOTES="${NOTES//$'\r'/'%0D'}"
28+
echo "NOTES: ${NOTES}"
29+
echo "::set-output name=notes::${NOTES}"
30+
31+
- name: Create Release
32+
id: create_release
33+
uses: actions/create-release@v1
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
36+
with:
37+
tag_name: ${{ github.ref }}
38+
release_name: ${{ github.ref }}
39+
body: |
40+
Changes since last release:
41+
42+
${{ steps.get_release_notes.outputs.notes }}
43+
44+
draft: true
45+
prerelease: false

0 commit comments

Comments
 (0)