#cargo-version #cargo-toml #semver #tool #automation #git

app cargo-incver

A small utility for manipulating the project version in Cargo.toml

2 releases (1 stable)

1.0.0 Oct 10, 2023
0.1.0 Oct 10, 2023

#419 in Cargo plugins

MIT and LGPL-3.0+

7KB
112 lines

cargo-incver

A small utility for manipulating the project version in Cargo.toml

CLI usage

Print full version number

cargo incver full get

Increment minor version

cargo incver minor inc

Set custom pre version

cargo incver pre set alpha

Gitlab CI example

The example below shows an example of gitlab jobs that increment version numbers depending on the name of the merge request source branch

increment-patch:
  stage: deploy
  image: simensgreen/incver
  rules:
    - if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^patch/
  script:
    - cargo incver patch inc

increment-minor:
  stage: deploy
  image: simensgreen/incver
  rules:
    - if: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^minor/
  script:
    - cargo incver minor inc

Where "simensgreen/incver" image is just:

FROM rust
RUN cargo install cargo-incver

Dependencies

~8.5MB
~146K SLoC