A Github Action to automatically bump and tag main with the latest SemVer formatted version.
name: Bump version
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Prepare local repository
run: git fetch --prune --unshallow --tags -f
- name: Bump version and push tag
uses: AlexisJasso/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
prefix: mygroup/
- token (required) - Required for permission to tag the repo.
- prefix (optional) - Appends the given prefix to the tag (e.g. PREFIX=myprefix-v would create a myprefix-v1.0.0 tag)
- npm (optional) - Update version in package.json file (default:
false
). - packageJsonPath (optional) - Specify the path of the package.json file
(default:
package.json
).
- tag - The latest tag after running this action.
- version - The semantic version without any "v" or other prefixes.
- bumped - Set to "true" if the version was bumped, otherwise "false"
Note: This action creates a lightweight tag.
Manual Bumping: Any commit message that includes #major
, #minor
,
or #patch
will trigger the respective version bump.
If two or more are present, the highest-ranking one will take precedence.
Automatic Bumping: If no #major
, #minor
or #patch
tag is contained in
the commit messages, no tag will be created.
Note: This action will not bump the tag if the
HEAD
commit has already been tagged.
- Add this action to your repo
- Commit some changes
- Either push to master or open a PR
- On push (or merge) to
master
, the action will:- Get latest tag
- Bump tag with minor version unless any commit message contains
#major
or#patch
- Pushes tag to github