Skip to main content

semantic version helper tool

Project description


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



$ semver-tool
$ semver-tool -f MNPR

Use Cases

Build docker images

I use this tool to build docker images using SemVer schema. The flow is this:

  • build image:latest with Commit 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-rc.2
image   1.2.3
image   1.2

Each image has Commit label with semver description, eg, 1.2.3-rc.2+git.22eeff

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for semver-tool, version 3.0.4
Filename, size File type Python version Upload date Hashes
Filename, size semver_tool-3.0.4-py2-none-any.whl (11.8 kB) File type Wheel Python version py2 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page