A GitHub Action that provides access to the individual parts of a SemVer2 version string.
- Provides access to the individual parts of a SemVer2 version string
- Supports removal of unwanted prefixes
- Fast execution
- Supports all platforms (Linux, macOS, Windows)
- Does not use external GitHub Actions dependencies
steps:
- name: Parse version
id: version
uses: zyactions/semver@v1
with:
version: '1.2.3-alpha.1+build'
- name: Print major version
run: |-
echo "Major: ${{ steps.outputs.version.major }}"
Note
If the version
starts with refs/
and/or tags/
, the prefix is automatically removed so that Git references can easily be used as input.
A string containing the semantic version to parse.
For example:
1.2.3-alpha.1+build
v2.3.4
refs/tags/v2.3.4
Defaults to GITHUB_REF
if not specified.
An optional newline separated list of version prefixes to strip from the input version (e.g. v
or release-v
).
Set true
to fail, if the input version
does not contain a valid semantic version.
Defaults to true
.
Signals, if the input version
contained a valid semantic version.
Note
GitHub Actions outputs are always strings. Please explicitly check this value for 'true'
and 'false'
(string) instead of relying on boolean operations.
The (sanitized) semantic version string with any prefix trimmed from it.
For example: 1.2.3-alpha.1+build
The major version.
For example: 1
The minor version.
For example: 2
The patch version.
For example: 3
The prerelease version part.
For example: alpha.1
The build/metadata version part.
For example: build
This action does not use external GitHub Actions dependencies.
Internal dependencies:
- semver-tool (bundled)
Versions follow the semantic versioning scheme.
SemVer Action is licensed under the MIT license.