A Github Action to decide the new release version based on the merged branch name.
May be used on a merged pull request event to decide the next release version based on the merged branch name:
- Next version is a new Major if source branch starts with
major/
orfeature-major/
. - It's a new Minor if source branch starts with
minor/
,feature-minor/
, orfeature/
. - It's a new Patch if source branch starts with
bugfix/
orhotfix/
.
-
Latest version is
4.8.15
and source branch ismajor/new-backend-api
:New release version is
5.0.0
. -
Latest version is
4.8.15
and source branch isminor/add-request-field
:New release version is
4.9.15
. -
Latest version is
4.8.15
and source branch isbugfix/blue-screen
:New release version is
4.8.16
.
# On a closed pull request:
on:
pull_request:
types: [closed]
branches:
- master
jobs:
job-name:
# Avoid pull requests that are closed but not merged:
if: github.event.pull_request.merged
runs-on: ubuntu-latest
steps:
# This step is required:
- uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Choose new release version
id: choose-release-version
uses: reloc8/[email protected]
with:
source-branch: 'major/new-backend-api'
latest-version: '4.8.15'
- name: Test
run: echo ${{ steps.choose-release-version.outputs.new-version }}