Have you ever made a mistake incrementing a project version?
Do you have multiple files to update the version at?
I was always forgetting to update a Dockerfile
label or a version constant in main.go
file. Inspired by npm bump
, I wrote version-bump.
This application allows easily incrementing a single/multi language project Semantic Version, committing the changes and tagging a commit.
- Supported languages: Go, Docker, JavaScript
- Semantic Versioning Compliant
- Update files in multiple directories of the project at once
- Commit and tag changes
Download latest release and move the file to one of the directories under your PATH
environmental variable.
version-bump has two modes of operation: automatic / manual. In automatic mode, version-bump will try to identify versions of all supported languages in a root of the project (wherever executed). In a manual mode, version-bump will read a configuration file and modify files according to it. It is expected be executed in a root of the project where the configuration file is.
Some languages, have a constant value in a specific file that contains a version, which are fairly easy to increment. But some languages are leaving that decision to a developer, thus version-bump assumes a constant position/value for them as well.
Language | Expected Values | Filename |
---|---|---|
Docker | org.opencontainers.image.version label |
Dockerfile |
Go | String constant named Version /version |
*.go |
JavaScript | JSON version field |
package.json , package-lock.json |
Run version-bump in a root of the project: version-bump <major/minor/patch>
-
Create a configuration
.bump
file in a root of the project. -
Add project languages and their configuration in a form of:
[ <language-name> ] enabled = true/false directories = [ <path>, <path>, ... ] exclude_files = [ <path>, <path>, ... ]
<language-name>
- one of[ 'docker', 'go', 'javascript' ]
enabled
- defaultfalse
directories
- default['.']
exclude_files
- default[]
-
Run version-bump in a root of the project:
version-bump <major/minor/patch>
Configuration Example:
[docker]
enabled = true
directories = [ '.', 'tools/qa' ]
[go]
enabled = true
directories = [ 'server', 'tools/cli', 'tools/qa' ]
exclude_files = [ 'server/server_test.go', 'tools/qa/main_test.go' ]
[javascript]
enabled = true
directories = [ 'client' ]
- Versions are expected to be consistent across all files
- In automatic mode, version-bump has all languages enabled
MIT © 2021-present Anton Yurchenko