## bumpversion
[<img alt="build status" src="https://img.shields.io/github/actions/workflow/status/romnn/bumpversion/build.yaml?branch=main&label=build">](https://github.com/romnn/bumpversion/actions/workflows/build.yaml)
[<img alt="test status" src="https://img.shields.io/github/actions/workflow/status/romnn/bumpversion/test.yaml?branch=main&label=test">](https://github.com/romnn/bumpversion/actions/workflows/test.yaml)
[](https://deps.rs/repo/github/romnn/bumpversion)
[<img alt="docs.rs" src="https://img.shields.io/docsrs/bumpversion/latest?label=docs.rs">](https://docs.rs/bumpversion)
[<img alt="crates.io" src="https://img.shields.io/crates/v/bumpversion">](https://crates.io/crates/bumpversion)
📚 **Documentation: [romnn.github.io/bumpversion](https://romnn.github.io/bumpversion/)**
This is an improved version of the popular [callowayproject/bump-my-version](https://github.com/callowayproject/bump-my-version) (formerly [peritus/bumpversion](https://github.com/peritus/bumpversion) and [c4urself/bump2version](https://github.com/c4urself/bump2version)) written in Rust.
#### Features
- No more global `pip` installs! Easy to install via `brew`, `cargo`, or precompiled static binary.
- Fully compatible with your existing configuration:
- `pyproject.toml`
- `.bumpversion.toml`
- `.bumpversion.cfg`
- `setup.cfg`
- `Cargo.toml` (planned)
### Installation
```bash
# will install `bumpversion` binary
brew install --cask romnn/tap/bumpversion
# will install `cargo-bumpversion` binary (to be used as `cargo bumpversion` subcommand)
brew install --cask romnn/tap/cargo-bumpversion
# or install from source (will install both `cargo-bumpversion` and `bumpversion` binaries)
cargo install --locked bumpversion-cli
```
### CLI usage
You can use this as a drop-in replacement for the Python `bumpversion`, `bump2version`, or `bump-my-version`.
```bash
# Show every change a patch release would make, without making it
bumpversion --dry-run --verbose patch
# Do it: rewrite the files, commit, tag
bumpversion patch
```
### Rust projects
Bumping the version in `Cargo.toml` leaves `Cargo.lock` stale. A pre-commit hook refreshes it, and
`additional_files` carries it into the same release commit:
```toml
[tool.bumpversion]
current_version = "1.4.2"
commit = true
tag = true
pre_commit_hooks = ["cargo metadata --offline --format-version 1 >/dev/null"]
additional_files = ["Cargo.lock"]
[[tool.bumpversion.files]]
filename = "Cargo.toml"
```
`cargo metadata` rewrites the lockfile as a side effect of resolving the workspace. Prefer it over
`cargo update`, which re-resolves every dependency and turns a release into an unreviewed dependency
upgrade. The [hooks documentation][lockfile] works the pattern through in full.
[lockfile]: https://romnn.github.io/bumpversion/docs/configuration/hooks/#rust-keeping-cargolock-in-the-release-commit
See the [documentation](https://romnn.github.io/bumpversion/) for the configuration reference, the
version-scheme model, and hooks.
#### Development
```bash
cargo run -- --dir ../dir/to/a/repo/with/.bumpversion.toml --verbose --dry-run patch
```