-
Notifications
You must be signed in to change notification settings - Fork 4
42 lines (35 loc) · 1.25 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
name: 'Release: Deploy PR'
on:
pull_request:
branches: [ master ]
types: [ closed ]
jobs:
release-deploy:
if: github.event.pull_request.merged == true # only run on PR merge
runs-on: ubuntu-latest
steps:
- name: Configure release
run: |
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
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.BOT_GITHUB_TOKEN }}
commit: '${{ github.sha }}'
tag: '${{ env.RELEASE_TAG }}'
body: '${{ env.PR_BODY }}'
draft: false
prerelease: ${{ env.RELEASE_PRERELEASE }}