-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (36 loc) · 1.12 KB
/
publish-new-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
name: "Publish new release"
on:
pull_request:
branches:
- main
types:
- closed
jobs:
release:
name: Publish new release
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- name: Extract version from branch name
if: startsWith(github.event.pull_request.head.ref, 'release/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#release/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Validate the version
id: regex-match
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ env.RELEASE_VERSION }}
regex: '^v\d+(\.\d+){2}$'
- name: Create Release
if: ${{ steps.regex-match.outputs.match != '' }}
id: generate_changelog
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: ${{ env.RELEASE_VERSION }}
tag: ${{ env.RELEASE_VERSION }}
name: ${{ env.RELEASE_VERSION }}
publish: false