Github Action for automatic semantic versioning based on commit messages.
This action is based on the Conventional Commits specification.
The action will read the last commit message and determine the next version based on the following rules:
- If the commit message contains
BREAKING CHANGE|breaking:
, the major version will be incremented. - If the commit message contains
feat|feature:
, the minor version will be incremented. - If the commit message contains
build|chore|ci|docs|fix|perf|refactor|revert|style|test:
, the patch version will be incremented. - Otherwise, if
error-on-invalid-commit
istrue
, the action will throw an error.
If the repository does't have a tag yet, the action will return the version 1.0.0
or the version specified in the initial-version
input.
| Required: false
| Default: The commit message
The commit message to use for versioning. If not provided, the action will use the commit message that triggered the workflow.
| Required: false
| Default: The latest tag
The latest version in the repository. If not provided, the action will use the latest tag that matches the pattern.
| Required: false
| Default: 1.0.0
The version to use if the repository does't have a tag yet.
| Required: false
| Default: false
Whether to throw an error if the commit message is invalid.
| Required: false
| Default: null
If the commit message doesn't match any of the labels, the action will use this label to determine the version.
Can be major
, minor
, or patch
.
| Required: false
| Default: (v)?(\d+\.\d+\.\d+)
The pattern to match the tags in the repository.
| Required: false
| Default: ""
The prefix to add to the new version.
| Required: false
| Default: false
Whether to create a new tag in the repository.
The new version calculated based on the commit message.
The new tag to create in the repository. If create-tag
is false
, this output will be empty.
name: Generate Version
id: gen-version
uses: Langsdorf/actions-auto-sem-ver@1.0.1
with:
create-tag: true
name: Generate Version
id: gen-version
uses: Langsdorf/actions-auto-sem-ver@1.0.1
with:
initial-version: "1.0.0"
tag-pattern: '(v)?(\d+\.\d+\.\d+)'
tag-prefix: "v"
create-tag: true
name: Output version
run: echo "The new version is ${{ steps.gen-version.outputs.version }}" # The new version is 1.0.1
name: Output tag
run: echo "The new tag is ${{ steps.gen-version.outputs.tag }}" # The new tag is (v)?1.0.1
This project is licensed under the MIT License - see the LICENSE file for details.