The process, in detail:
git describe
to figure out the nearest ancestor version tag (v*
) of the current commit[(major|minor|patch)(-release)?]
(i.e. [major]
, [minor]
, [patch]
, [major-release]
, etc)defaultBump
(defaults to minor
)minBump
(default unset), use minBump
instead (conversely used to ensure all new master
commits create minor versions instead of patch releases)releaseTrigger
is auto
, a new release is always madereleaseTrigger
is commit
, a new release is only made if the commit message contains [release]
(or [major-release]
, [minor-release]
, [patch-release]
)exportEnv
)doTag
, default true
)doPush
, default true
except for Pull Requests)As of 2020-12, a versionTemplate
option is allowed, which provides a convenient way to specify numComponents
, minBump
, as well as validating that the chosen version matches the expected pattern.
Examples include:
v1.2.x
: allow only patch increments
v1.x.x
: allow minor or patch increments
v1.x.0
: allow only minor increments
vx.x.x
: equivalent to numComponents: 3
The handling of versionTemplate
is intentionally complex, to "do the right thing" for common use cases without requiring the use of unweildy workflow expressions:
refs/heads/
is stripped offv
, then at least one digit, then .
), it will be ignoredversionTemplate
and numComponents
, the max() of the two values is taken (so you can have a v2.x
branch but still use 3 components)versionTemplate
and minBump
, minBump
is ignored (typically minBump
is used only on the main branch, to use on a version branch you will need to name it e.g. v2.x.0
)This lets you pass in the branch name and have it work for both master
and appropriately-named version branches, like so:
- uses: timbertson/autorelease-tagger-action@v1
with:
numComponents: 3
minBump: minor
versionTemplate: ${{ github.base_ref || github.ref }}
That will use the base_ref
(destination branch) for a pull request, and the current branch for a push event.
For the main branch it acts like a versionTemplate of vx.x.0
thanks to the default numComponents
and minBump
.
Inpired by the Github Tag Bump action, but with a few improvements:
git describe
doPush
defaults to false for PRs)