-
Notifications
You must be signed in to change notification settings - Fork 204
34 lines (29 loc) · 1.03 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
name: Release
on:
pull_request:
branches: [ master ]
types: [ closed ]
jobs:
release:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup variables
id: setup
run: |
VERSION=$(echo ${{github.event.pull_request.head.ref}} | cut -d/ -f2)
CHANGELOG=$(sed '0,/^## /d;/^## /Q' CHANGELOG.md)
newline=$'\n'
CHANGELOG="## v${VERSION}${newline}${CHANGELOG}"
echo "::set-output name=version::$VERSION"
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Github Tag & Release
uses: ncipollo/release-action@v1
with:
tag: "v${{ steps.setup.outputs.version }}"
commit: ${{ github.event.pull_request.merge_commit_sha }}
body: ${{ env.CHANGELOG }}
token: ${{ secrets.GITHUB_TOKEN }}