#semver #conventional-commit

app what-bump

Detect required version bump based on conventional commit messages

6 releases (stable)

✓ Uses Rust 2018 edition

1.0.5 Feb 28, 2020
1.0.3 Feb 14, 2020
1.0.2 Jan 20, 2020
0.1.0 Nov 2, 2019

#22 in Build Utils

49 downloads per month

Custom license

22KB
395 lines

What Bump?

CircleCI

what-bump is a simple tool that reads the commit history of a git repository, and uses commit messages to decide what kind of version bump is required.

what-bump assumes that commit messages are written according to the Conventional Commits specification, and that your software uses Semantic Versioning.

Moreover, if you provide what-bump with the current version number of your software, it will tell you what the next version number has to be.

Rationale

Plenty of tools exist that can read Conventional Commit messages and manage software releases: see for example the list in the conventional commit website, as well as calcver.

However, most of those tools are deeply integrated with NPM, or somehow assume that you're using NPM, try to manage the entire release process of your software, and are not trivial to set up (especially if you're not using NPM!). The only tool I could find that does not integrate with NPM is calcver, but it is very young, very undocumented, and probably more powerful and/or complex than I need a tool to be.

This tool, what-bump, sets out to be a simple, self-explanatory, zero-configuration utility to do one and only one thing: determine your software's next version number based on all the commit messages up to a previous revision. You need to specify what the previous revision is (we assume you have it tagged and know enough bash magic to do it) and what the current version is (ditto).

Installation

The easiest way to get what-bump is installing it using cargo, with the following command:

cargo install what-bump

If you prefer Docker, there is an official image on dockerhub: https://hub.docker.com/r/albx79/what-bump

Usage

Just type

what-bump --help

To get all the explanation you need.

Basically, assuming you tagged your previous version as v1.0.2, just type

what-bump v1.0.2 --from 1.0.2

to get the next version number printed to standard output.

Compliance

what-bump is a little bit more accepting than Conventional Commits specifies.

In particular, it only checks that the commit type starts with "fix" or "feat" (case insensitive), therefore it will also accept things like "feature", "fixed", or "fixing".

Also, any other commit type, or commits that don't comply with the spec, will be ignored and won't contribute to a version bump.

Build

With Cargo

what-bump is written in Rust. You'll need at least version 1.36 to build (that's what I used). Install rust following the instructions on the official website.

It depends on git2-rs, which requires libgit2 to be installed on your system. It should already be available if you're using git.

To build from sources, clone the repository and build with:

cargo build --release

Then you can install it locally with

cargo install --path .

With Docker

Alternatively, if you have docker, you can build what-bump using the Dockerfile provided:

docker build . -t what-bump

And then run it with e.g.:

docker run -v $PWD:/data what-bump --path /data --help

Dependencies

~13MB
~297K SLoC