| Crates.io | cargo-version-info |
| lib.rs | cargo-version-info |
| version | 0.0.11 |
| created_at | 2026-01-02 21:58:42.350272+00 |
| updated_at | 2026-01-25 00:21:54.914955+00 |
| description | Cargo subcommand for unified version management across CI/CD, Rust code, and shell scripts |
| homepage | https://github.com/dataroadinc/cargo-version-info |
| repository | https://github.com/dataroadinc/cargo-version-info |
| max_upload_size | |
| id | 2019264 |
| size | 542,188 |
A Cargo subcommand for unified version management across CI/CD, Rust code, and shell scripts.
cargo-version-info provides a single source of truth for version
operations, replacing scattered version logic in GitHub Actions
workflows, bash scripts, Makefiles, and Rust build scripts.
The fastest way to install pre-built binaries:
cargo install cargo-binstall
cargo binstall cargo-version-info
Build from source (slower, requires Rust toolchain):
cargo install cargo-version-info
cargo version-info nextCalculate the next patch version from the latest GitHub release.
# Basic usage (auto-detects repo from git remote)
cargo version-info next
# Specify repository explicitly
cargo version-info next --owner my-org --repo my-project
# Output as tag format
cargo version-info next --format tag
# Output as JSON
cargo version-info next --format json
Output formats:
version (default): Just the version number (e.g., 0.0.6)tag: Version with v prefix (e.g., v0.0.6)json: JSON object with latest, next, and next_tag fieldscargo version-info currentGet the current version from Cargo.toml.
# Read from default Cargo.toml
cargo version-info current
# Specify custom manifest path
cargo version-info current --manifest ./crates/my-crate/Cargo.toml
# Output as JSON
cargo version-info current --format json
Output formats:
version (default): Just the version numberjson: JSON object with version fieldcargo version-info latestGet the latest published GitHub release version.
# Auto-detect repository
cargo version-info latest
# Specify repository
cargo version-info latest --owner dataroadinc --repo my-project
# Output as tag format
cargo version-info latest --format tag
Output formats:
version (default): Just the version numbertag: Version with v prefixjson: JSON object with version and tag fieldscargo version-info devGenerate a dev version from the current git SHA.
# Use current directory
cargo version-info dev
# Specify repository path
cargo version-info dev --repo-path ./some/path
# Output as JSON
cargo version-info dev --format json
Output format: 0.0.0-dev-<short-sha> (e.g., 0.0.0-dev-a1b2c3d)
cargo version-info tagGenerate a tag name from a version string.
# Generate tag from version
cargo version-info tag 0.1.2
# Output as JSON
cargo version-info tag 0.1.2 --format json
Output: v0.1.2
cargo version-info bumpBump the version in Cargo.toml and create a commit.
# Bump patch version (0.1.0 -> 0.1.1)
cargo version-info bump --patch
# Bump minor version (0.1.0 -> 0.2.0)
cargo version-info bump --minor
# Bump major version (0.1.0 -> 1.0.0)
cargo version-info bump --major
# Set specific version
cargo version-info bump --version 2.0.0
# Update version without committing
cargo version-info bump --patch --no-commit
# Skip Cargo.lock update
cargo version-info bump --patch --no-lock
# Skip README.md version updates
cargo version-info bump --patch --no-readme
Features:
Cargo.toml versionCargo.lock (unless --no-lock)README.md (unless --no-readme)chore(version): bump X.Y.Z -> X.Y.ZPure Rust Git Operations:
All git operations (commits, tree building, index manipulation) are
performed using gix - a pure Rust
git implementation. This means cargo version-info bump works in
environments where the git CLI is not installed, such as minimal
Docker containers or restricted CI runners.
Commit Signing (No GPG/SSH CLI Required):
SSH commit signing is implemented in pure Rust using the ssh-key
crate. When signing is enabled in git config, the tool signs commits
by communicating directly with ssh-agent - no ssh-keygen or gpg
CLI tools needed.
# Configure signing (standard git config)
git config commit.gpgsign true
git config gpg.format ssh
git config user.signingkey ~/.ssh/id_ed25519.pub
# bump will create signed commits without calling git or ssh-keygen
cargo version-info bump --patch
GPG signing is not yet implemented (requires gpg-agent).
cargo version-info compareCompare two versions.
# Compare versions (outputs true if version1 > version2)
cargo version-info compare 0.1.2 0.1.3
# Output as JSON
cargo version-info compare 0.1.2 0.1.3 --format json
# Output as diff format
cargo version-info compare 0.1.2 0.1.3 --format diff
Output formats:
bool (default): true if version1 > version2, false otherwisejson: JSON object with comparison resultdiff: Human-readable comparison (e.g., 0.1.2 < 0.1.3)GITHUB_TOKEN: GitHub personal access token for API access
(optional, falls back to gh CLI)GITHUB_REPOSITORY: Repository in owner/repo format
(auto-detected from git remote if not set)Replace bash scripts in GitHub Actions workflows:
- name: Calculate next version
run: |
NEXT_VERSION=$(cargo version-info next --format version)
echo "version=$NEXT_VERSION" >> $GITHUB_OUTPUT
Replace version extraction logic:
# Instead of: VERSION=$(grep '^version' Cargo.toml | ...)
VERSION=$(cargo version-info current --format version)
# Instead of: gh release list ... | jq ...
LATEST=$(cargo version-info latest --format version)
Use in Make targets:
VERSION := $(shell cargo version-info current --format version)
NEXT_VERSION := $(shell cargo version-info next --format version)
Can be called from build.rs:
# fn main() -> Result<(), Box<dyn std::error::Error>> {
let output = std::process::Command::new("cargo")
.args(["version-info", "current", "--format", "version"])
.output()?;
let version = String::from_utf8(output.stdout)?;
# Ok(())
# }
This tool is designed to replace:
calculate-next-version and get-version actions.bash/*.sh filescrates/ekg-util-env/build.rs (can call this tool)Same as the workspace (see root LICENSE file).