Github action that can be used to parse a semver string. It leverages semver behind the scene.
Version in this repository means annotated git tag named according to these guidelines.
Currently, versioning will be done automatically on master. Pull requests against master are checked to contain one of the following labels:
bump:patch
bump:minor
bump:major
In repository, following versioning needs to be followed:
With semver style, every pull request merge will bump version number in following style:
- patch, bugfix, typo, configuration change in non-production: micro version
- minor, backward-compatible new feature, backward-compatible feature enhancement, configuration change: minor version
- major, non-backward compatible change, removal of a feature: major version
Versioning will follow naming of vMAJOR.MINOR.PATCH
Required Raw input string to be parsed. Its a string either containing a semver or is a semver itself.
Optional Regex pattern to extract semver substring from the raw input. It is mandatory to match a single substring from the input string.
MAJOR
part of the semver. Eg. 3
in 3.4.5-alpha+1.2
MINOR
part of the semver. Eg. 4
in 3.4.5-alpha+1.2
PATCH
part of the semver. Eg. 5
in 3.4.5-alpha+1.2
prerelease
part of the semver. Eg. alpha
in 3.4.5-alpha+1.2
build
part of the semver. Eg. 1.2
in 3.4.5-alpha+1.2
Full representation of the semver. For eg. 3.4.5-alpha+1.2
in 3.4.5-alpha+1.2
...
job:
test_semver_parser:
runs_on: ubuntu_latest
steps:
- name: Parse semver string
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: 'refs/tags/v1.0.4'
version_extractor_regex: '\/v(.*)$'
- name: Use parsed semver
run: |
echo "v${{ steps.semver_parser.outputs.major }}"
echo "v${{ steps.semver_parser.outputs.minor }}"
echo "v${{ steps.semver_parser.outputs.patch }}"
echo "v${{ steps.semver_parser.outputs.prerelease }}"
echo "v${{ steps.semver_parser.outputs.build }}"
echo "v${{ steps.semver_parser.outputs.fullversion }}"
...
job:
test_semver_parser:
runs_on: ubuntu_latest
steps:
- name: Parse semver string
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: '1.0.4'
- name: Use parsed semver
run: |
echo "v${{ steps.semver_parser.outputs.major }}"
echo "v${{ steps.semver_parser.outputs.minor }}"
echo "v${{ steps.semver_parser.outputs.patch }}"
echo "v${{ steps.semver_parser.outputs.prerelease }}"
echo "v${{ steps.semver_parser.outputs.build }}"
echo "v${{ steps.semver_parser.outputs.fullversion }}"
This library is under the MIT license.