update-version 1.0.0

A CLI tool for updating version numbers across multiple file types (Cargo.toml, package.json, tauri.conf.json) with git integration
Documentation

update-version

A CLI tool for updating version numbers across multiple file types in your project. Supports automatic version incrementing and git integration for commits, tags, and pushes.

Features

  • Update versions in multiple file formats simultaneously
  • Auto-increment patch version when no version is specified
  • Git integration: commit, tag, and push changes automatically
  • Uses local git credentials (SSH keys, credential helpers)
  • Recursive directory scanning

Installation

From crates.io (when published)

cargo install update-version

From GitHub

cargo install --git https://github.com/Drew-Chase/update-version.git

From Source

git clone https://github.com/Drew-Chase/update-version.git

cd update-version

cargo install --path .

Usage

The binary is named uv for quick access.

# Set version to 1.2.3 in all supported files

uv 1.2.3


# Auto-increment patch version (1.2.3 -> 1.2.4)

uv


# Update only Cargo.toml files

uv -t toml 1.2.3


# Update and commit changes

uv -g commit 1.2.3


# Update, commit, and push

uv -g commit-push 1.2.3


# Update, commit, tag as v1.2.3, and push both

uv -g commit-push-tag 1.2.3


# Update in a specific directory

uv -p ./my-project 1.2.3

Command Line Arguments

Argument Short Long Default Description
VERSION - - - The new version to set (e.g., 1.2.3). If omitted, increments the patch version.
-t -t --types all File types to update. See Supported Types.
-g -g --git-mode none Git operations to perform. See Git Modes.
-p -p --path ./ Path to the project directory.
-v -v --verbose false Enable verbose/debug logging.

Supported Types

Value Files Description
all All below Updates all supported file types (default)
toml Cargo.toml Rust package manifests
package-json package.json Node.js package manifests
tauri-config tauri.conf.json Tauri application config

Git Modes

Value Description
none No git operations (default)
commit Stage changes and create a commit
commit-push Commit and push to remote
commit-tag Commit and create a version tag (e.g., v1.2.3)
commit-push-tag Commit, tag, and push both to remote

Git Commit Format

Commits are created with the message:

chore: bump version to {version}

Tags are created as annotated tags with the format v{version} (e.g., v1.2.3).

Git Authentication

The tool uses your local git credentials automatically:

  1. SSH Agent - If running, SSH keys are used from the agent
  2. SSH Keys - Checks ~/.ssh/ for id_ed25519, id_rsa, id_ecdsa
  3. Credential Helper - Uses git's configured credential helper for HTTPS
  4. Default - Falls back to default credentials

Examples

Update a Tauri + Rust Project

# Update all version files and push with a tag

uv -g commit-push-tag 2.0.0

This will update:

  • Cargo.toml (Rust)
  • package.json (Node.js/frontend)
  • tauri.conf.json (Tauri config)

Then commit, tag as v2.0.0, and push everything.

CI/CD Integration

# In your release workflow

uv -g commit-push-tag ${{ github.event.inputs.version }}

Increment Patch Version

# If current version is 1.2.3, this sets it to 1.2.4

uv -g commit-push

Library Usage

You can also use update-version as a library in your Rust projects.

[dependencies]

update-version = "0.1"

Example: Update Cargo.toml

use semver::Version;
use update_version::parsers::{toml_parser::TomlParser, Parser};

fn main() -> anyhow::Result<()> {
    let new_version = Version::parse("2.0.0")?;
    TomlParser::update_version("./", &new_version)?;
    Ok(())
}

Example: Auto-increment Version

use update_version::parsers::{toml_parser::TomlParser, Parser};

fn main() -> anyhow::Result<()> {
    // Get current version
    let current = TomlParser::get_current_version("./")?;
    println!("Current: {}", current);

    // Increment patch version (1.2.3 -> 1.2.4)
    TomlParser::increment_version("./")?;
    Ok(())
}

Example: Git Release

use semver::Version;
use update_version::{
    arguments::GitMode,
    git::GitTracker,
    parsers::{toml_parser::TomlParser, Parser},
};

fn main() -> anyhow::Result<()> {
    let version = Version::parse("1.0.0")?;

    // Update version
    TomlParser::update_version("./", &version)?;

    // Commit, tag, and push
    let git = GitTracker::open("./")?;
    git.execute_git_mode(GitMode::CommitPushTag, &version.to_string())?;

    Ok(())
}

Run the included examples with:

cargo run --example update_cargo_toml

cargo run --example increment_version

cargo run --example update_all_types

cargo run --example git_release