A Node.js executable package determining semantic version bumps based on the conventional commits spec.
See also version-bumper-action GitHub action.
Upgrading from version 2 to 3? Click here.
-
The output was changed from a space-delimited text to a JSON object:
-
old
2.1.5 2.1.6-dev
-
new
{"current":"2.1.4","bump":"patch","next":"2.1.5","dev":"2.1.6-dev"}
-
old
-
Changes in the option flags:
- --changelog was removed. Creating a changelog file is no longer supported.
- --outputtype was removed. Output to file is no longer supported.
- --preset was removed. Selecting a preset is no longer supported.
- --repopath was changed to --repo (repopath will eventually be removed).
- --bumpoverride was changed to --bump (bumpoverride will eventually be removed).
- Changes in the container image mount target:
- from /usr/share/repo
- to /repo
# old v2 run command
docker run --rm -v $PWD:/usr/share/repo tomerfi/version-bumper:latest --repopath /path/to/git --bumpoverride major
# new v3 run command
docker run --rm -v $PWD:/repo tomerfi/version-bumper:latest --repo /path/to/git --bump major
The version-bumper tool is executed using npx
or consumed as a standard package.
We also push a container image encapsulating the executable package to docker hub.
The following examples assume:
- The current working directory is a git repository.
- The latest semver tag is 2.1.4.
- Commit messages are based on the conventional commits spec.
$ npx @tomerfi/version-bumper@latest
$ docker run --rm -v $PWD:/repo tomerfi/version-bumper:latest
podman users? Click here.
$ podman run --privileged --rm -v $PWD:/repo:ro docker.io/tomerfi/version-bumper:latest
For commits with a fix type, the output of the above commands will be:
{"current":"2.1.4","bump":"patch","next":"2.1.5","dev":"2.1.6-dev"}
For commits with a feat type, the output of the above commands will be:
{"current":"2.1.4","bump":"minor","next":"2.2.0","dev":"2.2.1-dev"}
For commits containing the text BREAKING CHANGE in their body, the output of the above commands will be:
{"current":"2.1.4","bump":"major","next":"3.0.0","dev":"3.0.1-dev"}
Occasionally, we may want to use this only for bumps; no git repository is required.
$ npx @tomerfi/version-bumper@latest -s 2.1.4 -b patch
$ docker run --rm tomerfi/version-bumper:latest -s 2.1.4 -b patch
{"current":"2.1.4","bump":"patch","next":"2.1.5","dev":"2.1.6-dev"}
$ npx @tomerfi/version-bumper@latest -s 2.1.4 -b minor
$ docker run --rm tomerfi/version-bumper:latest -s 2.1.4 -b minor
{"current":"2.1.4","bump":"minor","next":"2.2.0","dev":"2.2.1-dev"}
$ npx @tomerfi/version-bumper@latest -s 2.1.4 -b major
$ docker run --rm tomerfi/version-bumper:latest -s 2.1.4 -b major
{"current":"2.1.4","bump":"major","next":"3.0.0","dev":"3.0.1-dev"}
import { bumper } from '@tomerfi/version-bumper'
// prints { current: '2.1.4', bump: 'patch', next: '2.1.5', dev: '2.1.5-dev' }
bumper({source: "2.1.4", bump: 'patch'}).then(bump => console.log(bump))
// prints { current: '2.1.4', bump: 'minor', next: '2.2.0', dev: '2.2.1-dev' }
bumper({source: "2.1.4", bump: 'minor'}).then(bump => console.log(bump))
// prints { current: '2.1.4', bump: 'major', next: '3.0.0', dev: '3.0.1-alpha1' }
bumper({source: "2.1.4", bump: 'minor', label: '-alpha1'}).then(bump => console.log(bump))
Jasper Vaneessen 💻 |
Oleksandr Andriiako 🚇 |
Contributing guidelines are here.