semantic version helper tool
Project description
semver-tool
Print SemVer version for a git project. Git tags must match v?M.N.P
pattern.
You can print specific version components using fotmat string.
Full format string is MNPRBD, where:
- M - major
- N - minor
- P - patch
- R - prerelease
- B - build
- D - dirty
Usage
Examples:
$ semver-tool
4.1.2-rc2+gb10c717
$ semver-tool -f MNPR
4.1.2-rc2
$ semver-tool -f MNPR --rc dev
4.1.2-dev2
Use Cases
Build docker images
I use this tool to build docker images using SemVer schema. The flow is this:
- build
image:latest
withCommit
label - push it as
image:M.N.P-R
- push it as
image:M.N.P
- push it as
image:M.N
My build script has this code
current=$(semver_tool -f MNPR)
docker build --label Commit=$(semver_tool) -t image:$current
docker tag image:$current image $(semver_tool -f MNP)
docker tag image:$current image $(semver_tool -f MN)
which results in these images
image 1.2.3-rc2
image 1.2.3
image 1.2
Each image has Commit
label with semver description, eg, 1.2.3-rc2+g22eeff
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
semver-tool-2.0.0.tar.gz
(11.0 kB
view hashes)
Built Distribution
Close
Hashes for semver_tool-2.0.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d872c04d73b39705aac810918e7af051977129df5cd92ea9386eed9d3cf0c8c |
|
MD5 | 1cdf8332dc7d7ff214c7e5649c840c01 |
|
BLAKE2b-256 | 0e598377efd56afff7a48a217107301e5f6c9d75823216250fc6d2c7d06bee3c |