auto-semver-action allows you to easily determine the next version number.
Automatically determines the next semantic version number by using repository tags. Uses the commit messages to determine the type of changes in the repository.
Supported release tags in commit messages:
If commit messages do not match any tag below, the default releaseType is used.
#major, #premajor, #minor, #preminor, #patch, #prepatch, #prerelease
Behavior details:
- Tag matching is case-insensitive (
#MAJORworks). - Tags are matched as exact hashtag tokens (
#majorfixdoes not count as#major). incrementPerCommit: false→ evaluates all commit messages, picks the highest priority tag, and increments once.incrementPerCommit: true→ increments for each commit; commits without a tag use the defaultreleaseType.
Assume current version is 1.0.0.
| Commit messages | incrementPerCommit | releaseType | Result |
|---|---|---|---|
feat: add x #minor |
false |
patch |
1.1.0 |
feat #minor, breaking change #major, fix #patch |
false |
patch |
2.0.0 (highest once) |
feat #minor, breaking change #major, fix #patch |
true |
patch |
2.1.1 |
docs update, chore cleanup |
false |
minor |
1.1.0 (default used) |
feat #MAJOR |
false |
patch |
2.0.0 (case-insensitive) |
feat #majorfix |
false |
patch |
1.0.1 (partial tag ignored, default used) |
docs update |
false |
invalid |
1.0.1 (falls back to patch) |
release prep #prepatch + identifier: beta |
false |
patch |
1.0.1-beta.0 |
Optional Semver identifier for version (beta,alpha..).
Optional Increments a version for each commit (true,false).
Required Default semantic version release type.
major, premajor, minor, preminor, patch, prepatch, or prerelease.
Notes:
releaseTypeis case-insensitive (PATCHis valid).- If an invalid value is provided, action falls back to
patchand logs a warning.
Required. Used to make API requests for looking existing tags. Pass in using secrets.GITHUB_TOKEN.
steps:
- name: Auto Increment Semver Action
uses: MCKanpolat/auto-semver-action@v3
id: versioning
with:
releaseType: patch
incrementPerCommit: false
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Next Release Number
run: echo ${{ steps.versioning.outputs.version }}To see debug output from this action, you must set the secret ACTIONS_STEP_DEBUG to true in your repository.