-
-
Notifications
You must be signed in to change notification settings - Fork 6
38 lines (36 loc) · 1.41 KB
/
detect_version_bump.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
name: Version Bump merged
on:
pull_request:
types:
- "closed"
branches:
- "main"
jobs:
trigger-release:
runs-on: ubuntu-latest
if: github.event.pull_request.merged &&
startsWith(github.head_ref, 'bump_version_to_') &&
startsWith(github.event.pull_request.title, 'Bump version') &&
contains(github.event.pull_request.title, ' → ')
environment: Create Release
steps:
- name: Get new version
id: get-new-version
run: |
NEW_VERSION=$(echo ${{ github.head_ref }} | cut -d _ -f4 )
echo "::set-output name=version::$NEW_VERSION"
- name: Is prerelease?
id: is-prerelease
run: |
IS_PRERELEASE=$([[ "${{ steps.get-new-version.outputs.version }}" == *-[a-z]* ]] && echo true || echo false)
echo "::set-output name=result::$IS_PRERELEASE"
- name: Create Release
# Using full SHA for security
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
uses: ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e # v1.12.0
with:
token: ${{ secrets.ACCESS_TOKEN }}
tag: v${{ steps.get-new-version.outputs.version }}
name: v${{ steps.get-new-version.outputs.version }} Release
commit: main
prerelease: ${{ steps.is-prerelease.outputs.result }}