Documentation
¶
Overview ¶
gitsemver prints or validates semVer-compatible version strings for git refs.
Usage:
gitsemver [flags] gitsemver validate [--type dev|rc|stable|any] <version> gitsemver version
Without a subcommand it resolves and prints the version for a git ref:
For a ref that carries a stable tag (vX.Y.Z) it prints X.Y.Z.
For a pre-release tag (vX.Y.Z-rc.N) it prints X.Y.Z-rc.N.
For an untagged ref it prints a dev build:
X.Y.(Z+1)-dev.<branch>.<YYYY-MM-DD>.<HH-MM-SS>
where X.Y.Z is the most recent stable ancestor tag reachable from the ref,
or 0.0.0 when none exists.
The "validate" subcommand checks whether a version string matches the expected format. It exits 0 and prints "valid" on success, exits 1 and prints "invalid" otherwise.
The "version" subcommand prints the build version (git tag), git SHA, and build timestamp embedded at link time.
Environment variables:
GS_BRANCH_NAME Override the branch name embedded in dev builds.
Defaults to the HEAD branch of the repo, then "unknown".
GS_GIT_TAG_PREFIX Monorepo support: only consider tags prefixed with
"<value>/", e.g. "module-a/v1.2.3".
Click to show internal directories.
Click to hide internal directories.