zig-utils/zig-bump
A simple, fast version bumping tool for Zig projects.
A simple, fast version bumping tool for Zig projects. Updates the version in your build.zig.zon file with a single command.
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 --help
Note: 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 major
By default, bump will:
build.zig.zon versionv1.0.1)# 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:
build.zig.zon file.version = "X.Y.Z" line| 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 all
zig-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
build.zig.zon file in the current directoryThe project includes comprehensive tests:
$ zig build test --summary all
Build Summary: 3/3 steps succeeded; 8/8 tests passed
Tests cover:
# .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.
git checkout -b feature/amazing-feature)git commit -m 'feat: add amazing feature')git push origin feature/amazing-feature)MIT License - see LICENSE file for details
Made with 🦎 by the Stacks team