Skip to main content

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

Usage

Examples:

$ semver-tool
4.1.2-rc.2+git.b10c717
$ semver-tool -f MNPR
4.1.2-rc.2

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.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

semver_tool-3.0.4-py2-none-any.whl (11.8 kB view details)

Uploaded Python 2

File details

Details for the file semver_tool-3.0.4-py2-none-any.whl.

File metadata

  • Download URL: semver_tool-3.0.4-py2-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.12

File hashes

Hashes for semver_tool-3.0.4-py2-none-any.whl
Algorithm Hash digest
SHA256 22f8893bf45a2dd3542ee36e91be6b765a81f2fd662fbba9ecaca2fcb997846e
MD5 75fc420c46bf5844df438c7c5e8089ee
BLAKE2b-256 716a5e11255f1285ffc9f06bbfd7a5c94931202fde5712d6c9e358bf55dae6e1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page