A GitHub Action to automatically bump and tag master, on merge, with the latest SemVer formatted version.
# example: on merge to master from pull request
name: Bump version
on:
pull_request:
types:
- closed
branches:
- master
jobs:
build:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: '0'
- name: Bump version and push tag
uses: KoaLaYT/github-tag-action@v1 # Don't use @master or @v1 unless you're happy to test the latest version
- new_tag - The value of the newly created tag.
Note: This action creates a lightweight tag.
Manual Bumping: If PR title contains #major
Automatic Bumping: If PR title does not contains #major
, it will bump
based on PR's branch name.
- Bump
minor
if branch name starts withfeat/
orfeature/
. - Bump
patch
if branch name starts withfix/
,hotfix/
orbugfix/
. - Other branch names will fallback to 2.
- Add this action to your repo
- Commit some changes
- Open a PR and on merge, the action will:
- Get latest tag
- Bump tag based on your branch name, unless the PR title contains
#major
- Pushes tag to GitHub