-
-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (46 loc) · 1.59 KB
/
publish_release.yaml
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
49
50
51
52
53
54
name: publish_release
on:
pull_request:
types:
- closed
branches:
- main
env:
VERSION_TAG_PREFIX: "v"
jobs:
release:
name: Publish release
runs-on: ubuntu-latest
permissions:
contents: write
# only merge pull requests that begin with 'release/' or 'hotfix/'
if: github.event.pull_request.merged == true &&
(startsWith(github.head_ref, 'release/') || startsWith(github.head_ref, 'hotfix/'))
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GH_TOKEN }}
# needed by "gh pr create"
fetch-depth: 0
- name: Set release type as release
if: startsWith(github.head_ref, 'release/')
run: echo "RELEASE_TYPE=release" >> "$GITHUB_ENV"
- name: Set release type as hotfix
if: startsWith(github.head_ref, 'hotfix/')
run: echo "RELEASE_TYPE=hotfix" >> "$GITHUB_ENV"
- name: Extract version from release branch
env:
BRANCH_NAME: ${{ github.head_ref }}
BRANCH_PREFIX: '${{ env.RELEASE_TYPE }}/'
run: |
RELEASE_VERSION=${BRANCH_NAME#${BRANCH_PREFIX}}
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
- name: Test action 'Publish release'
uses: ghacts/gitflow/publish-release@main
with:
token: ${{ secrets.GH_TOKEN }}
release-type: ${{ env.RELEASE_TYPE }}
release-branch-prefix: '${{ env.RELEASE_TYPE }}/'
notes-file: '.changes/${{ env.VERSION_TAG_PREFIX }}${{ env.RELEASE_VERSION }}.md'