Provides the semantic versioning for the Repo.
Semantic versioning is like MAJOR
.MINOR
.PATCH
.
name: Git Auto Semver Tag
on:
push:
branches: [ main ]
jobs:
auto-tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- uses: ArvindSinghRawat/Git-Automatic-Semver-Tagging@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
If this doesn't work, try creating a Personal Access Token and save it in project's environment with name
PAT
and replace the following code
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with
GITHUB_TOKEN: ${{ secrets.PAT }}
- If last commit doesn't have any Tag, then proceed with the following steps.
- Checks for the last commit message
- If message for last commit starts with either Breaking or Major (case-insensitive), then increase a Major version (+1.0.0) and reset Minor and Patch versions.
- Otherwise, if message for last commit starts with either Feature or Minor (case-insensitive), then increase a Minor version (+0.1.0) and reset Patch version.
- Otherwise. increase the Patch version only. (+0.0.1)
Took inspiration from the following sources
- Stack Overflow: Automatic tagging of releases
- Github Action: Auto Tag Bump
- And the need of this type of versioning for my personal project.