-
Notifications
You must be signed in to change notification settings - Fork 3
48 lines (38 loc) · 1.31 KB
/
release-deploy.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
name: 'Release: Deploy PR'
on:
pull_request:
branches: [ master ]
types: [ closed ]
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
jobs:
release-deploy:
if: github.event.pull_request.merged == true # only run on PR merge
runs-on: ubuntu-latest
steps:
- name: Grab PR Title
run: |
set -e
PR_TITLE=$(jq -r ".pull_request.title" $GITHUB_EVENT_PATH)
PR_BODY=$(jq -r ".pull_request.body" $GITHUB_EVENT_PATH)
RELEASE_TAG=$(echo "${PR_TITLE}" | grep -oP "(?<=^Release: )v\d+\.\d+\.\d+(-rc\.\d+)?$")
if [[ "${RELEASE_TAG}" =~ -rc\.[0-9]+$ ]]; then
RELEASE_PRERELEASE=true
else
RELEASE_PRERELEASE=false
fi
echo "PR_TITLE=${PR_TITLE}" >> $GITHUB_ENV
echo "RELEASE_TAG=${RELEASE_TAG}" >> $GITHUB_ENV
echo "RELEASE_PRERELEASE=${RELEASE_PRERELEASE}" >> $GITHUB_ENV
echo 'PR_BODY<<END_OF_PR_BODY' >> $GITHUB_ENV
echo "${PR_BODY}" >> $GITHUB_ENV
echo 'END_OF_PR_BODY' >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: '${{ env.RELEASE_TAG }}'
release_name: '${{ env.RELEASE_TAG }}'
body: '${{ env.PR_BODY }}'
draft: false
prerelease: ${{ env.RELEASE_PRERELEASE }}