gha-svu is a GitHub Action that calculates semantic versions using SVU v3+.
It provides an easy way to manage versioning for your projects based on semantic versioning principles.
- Automatically calculates the next semantic version (
next,major,minor,patch,prerelease) - Display the current version (
current) - Provides metadata and prerelease identifiers for versions
- Supports custom tagging modes and patterns (
all,light, orheavy) - Pin to a specific
svuversion or install the latest release - Optionally pushes the calculated version tag to the remote repository
| Name | Description | Default | Required |
|---|---|---|---|
always |
If no commits trigger a version change, increment the patch (true/false). |
false |
No |
command |
SVU subcommand to run: current, next, major, minor, patch, prerelease. |
next |
No |
initial-version |
Initial version to use when no tags are present (v0). |
No | |
log-directory |
Only use commits that changed files in the given directories. | No | |
metadata |
Metadata to append to the version (e.g., +build.42). |
No | |
prerelease |
Prerelease identifier (e.g., alpha, beta). |
No | |
push-tag |
Push the new tag to the remote (true/false). |
false |
No |
svu-version |
SVU version to install (e.g., v3.2.3). Leave blank to install the latest. |
No | |
tag-mode |
Which tags to consider: all, light, heavy. |
all |
No |
tag-pattern |
Regex to ignore tags that do not match the given pattern. | No | |
tag-prefix |
Tag prefix (e.g., v). |
v |
No |
verbose |
Enable verbose SVU output (true/false). |
false |
No |
| Name | Description |
|---|---|
changed |
Whether the version has changed (true/false). |
current |
Current semantic version based on existing tags. |
next |
Next semantic version calculated by SVU. |
Below is an example of how to use this action in your GitHub workflow:
name: Semantic Versioning
on:
push:
branches:
- main
jobs:
versioning:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run gha-svu
uses: bencatlab/gha-svu@v0.1.0
with:
command: 'next'
push-tag: 'true'
prerelease: 'beta'
metadata: '+build.42'
verbose: 'true'
- name: Output version
run: echo "Next version is ${{ steps.svu.outputs.next }}"To retrieve the current semantic version without modifying or pushing tags:
with:
command: 'current'To always increment the patch version even if no commits trigger a version change:
with:
always: 'true'
command: 'next'To restrict tags to a specific pattern and prefix:
with:
tag-pattern: '^v[0-9]+\\.[0-9]+\\.[0-9]+$'
tag-prefix: 'v'To push the calculated version tag to the remote repository:
with:
push-tag: 'true'Feel free to open issues or pull requests for bug reports, feature ideas, or improvements !
Made with ❤️ by bencatlab