Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.52 KB

README.md

File metadata and controls

39 lines (29 loc) · 1.52 KB

bump-semver

A script for bumping the individual semantic version fields.

It looks for semantic version tags in the current git project and tags HEAD with the next incremental semantic version number. The semantic field that gets incremented is controlled by an argument to the script.

If HEAD is already tagged with a semantic version, the script will cowardly refuse to tag and let you know what version is already tagged for the HEAD commit.

Install

Just clone the repo and add bump.sh to $PATH, e.g.

ln -s $(pwd)/bump.sh /usr/local/bin/bump

Usage

Usage: bump [-p prefix] {major|minor|patch} | -l
Bumps the semantic version field by one for a git-project.

Options:
  -l  list the latest tagged version instead of bumping.
  -p  prefix [to be] used for the semver tags.

Examples

bumping

Given a git project with the highest semantic version tag being 0.0.0, or where no semantic version exists at all, the following three invocations will yield a new tag with the specified version number:

  • bump.sh major -> v1.0.0
  • bump.sh minor -> v0.1.0
  • bump.sh patch -> v0.0.1

For a project that uses a v-prefix, the optional prefix option can be used. Default prefix is v.

bump.sh -p v minor -> v0.1.0

When prefix is used, only semantic version tags with that prefix will be considered during bumping.

listing

List the highest semantic version following strict semver (n.n.n): bump.sh -l
Same but when using prefixed semver ([prefix]n.n.n), in this case with prefix v: bump.sh -p v -l