A simple, fast version bumping tool for Zig projects. Updates the version in your build.zig.zon file with a single command.
- π¦ Zig-Native - Written in Zig, for Zig projects
- β‘ Fast - Zero dependencies, compiles to native code (~231KB binary)
- π― Simple - One command to bump your version
- π¨ Interactive - Beautiful prompts show all version options
- π³ Git Integration - Auto-commit, tag, and push (like bumpx!)
- β Tested - Comprehensive test suite
- π Safe - Validates versions and handles errors gracefully
- π Production Ready - Used to version itself
git clone https://github.com/stacksjs/zig-bump.git
cd zig-bump
zig build -Doptimize=ReleaseFast
sudo cp zig-out/bin/bump /usr/local/bin/bump --helpNote: The binary is called
bump, but the project is calledzig-bump.
Run bump without arguments to get an interactive prompt:
$ bump
Current version: 1.0.0
Select version bump:
1) patch 1.0.0 β 1.0.1
2) minor 1.0.0 β 1.1.0
3) major 1.0.0 β 2.0.0
Enter selection (1-3): 1
β Successfully bumped version from 1.0.0 to 1.0.1# Bump patch version (commits, tags, pushes by default)
bump patch
# Bump minor version
bump minor
# Bump major version
bump majorBy default, bump will:
- Update your
build.zig.zonversion - Create a git commit
- Create a git tag (e.g.,
v1.0.1) - Push to remote
# Full workflow (default behavior)
bump patch # Updates, commits, tags, pushes
# Explicit --all flag (same as default)
bump minor --all
# Skip push (just commit and tag locally)
bump patch --no-push
# Just update the file (no git operations)
bump major --no-commit
# Preview changes without applying
bump minor --dry-run
# Custom tag name and message
bump patch --tag-name "release-1.0.1" --tag-message "Production release"# Starting with version 0.1.0
$ cat build.zig.zon
.{
.name = "my_project",
.version = "0.1.0",
}
# Bump patch
$ bump patch
Current version: 0.1.0
New version: 0.1.1
β Successfully bumped version from 0.1.0 to 0.1.1
$ cat build.zig.zon
.{
.name = "my_project",
.version = "0.1.1",
}zig-bump:
- Reads your
build.zig.zonfile - Finds the
.version = "X.Y.Z"line - Increments the appropriate version number
- Writes the updated content back to the file
| Command | Description | Example |
|---|---|---|
major |
Breaking changes | 1.0.0 β 2.0.0 |
minor |
New features | 1.0.0 β 1.1.0 |
patch |
Bug fixes | 1.0.0 β 1.0.1 |
| Flag | Description | Default |
|---|---|---|
-a, --all |
Commit, tag, and push | true |
-c, --commit |
Create git commit | true |
--no-commit |
Skip git commit | - |
-t, --tag |
Create git tag | true |
--no-tag |
Skip git tag | - |
-p, --push |
Push to remote | true |
--no-push |
Skip push | - |
--sign |
Sign commits/tags with GPG | false |
--no-verify |
Skip git hooks | false |
--tag-name <name> |
Custom tag name | v{version} |
--tag-message <msg> |
Custom tag message | Release {tag} |
| Flag | Description |
|---|---|
--dry-run |
Preview changes without applying |
-y, --yes |
Skip confirmation prompts |
-h, --help |
Show help message |
# Debug build
zig build
# Release build
zig build -Doptimize=ReleaseFast
# Run directly
zig build run -- patch# Run all tests
zig build test
# Run with verbose output
zig build test --summary allzig-bump/
βββ build.zig # Build configuration
βββ build.zig.zon # Package manifest
βββ src/
β βββ main.zig # Main CLI implementation
β βββ test_version.zig # Unit tests
βββ README.md # This file
- Zig 0.15.0 or later
- A
build.zig.zonfile in the current directory
The project includes comprehensive tests:
$ zig build test --summary all
Build Summary: 3/3 steps succeeded; 8/8 tests passedTests cover:
- β Major version bumping
- β Minor version bumping
- β Patch version bumping
- β Version parsing from different formats
- β Error handling for invalid versions
- β Error handling for invalid release types
# .github/workflows/release.yml
name: Release
on:
push:
branches: [main]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Zig
uses: goto-bus-stop/setup-zig@v2
- name: Install zig-bump
run: |
git clone https://github.com/stacksjs/zig-bump.git
cd zig-bump && zig build -Doptimize=ReleaseFast
sudo cp zig-out/bin/bump /usr/local/bin/
- name: Bump version
run: bump patch --no-push
- name: Push changes
run: git push --follow-tags# .git/hooks/pre-push
#!/bin/bash
echo "Bumping patch version..."
bump patch --no-push- Basic version bumping (major, minor, patch)
- Comprehensive test suite
- Self-hosted (zig-bump can bump itself)
- Git integration (auto-commit, tag, push)
- Dry-run mode
- Custom tag names and messages
- Sign commits and tags
- Skip git hooks
- Interactive prompts
- Prerelease versions (alpha, beta, rc)
- Custom version formats
- Workspace support (multiple packages)
- Configuration file support
| Tool | Language | Size | Speed | Zig-Native |
|---|---|---|---|---|
| zig-bump | Zig | ~100KB | β‘ | β |
| npm version | JavaScript | ~40MB | π | β |
| cargo-bump | Rust | ~2MB | π | β |
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file for details
- Built with Zig
- Inspired by bumpx
- Created by the Stacks team
- π Report a bug
- π‘ Request a feature
- π Read the docs
Made with π¦ by the Stacks team