bumper (0.19.0)
Installation
[registries.forgejo]
index = "sparse+ " # Sparse index
# index = " " # Git
[net]
git-fetch-with-cli = truecargo add bumper@0.19.0 --registry forgejoAbout this package
git version bumper
- determines the semantic versioning impact (major, minor or patch) of the conventional commits since the last git tag
- increments the git tag by the impact (v0.0.1 -> PATCH -> v0.0.2)
- applies the version bump to files given as arguments (
bumper [files...]) - applies the version bump in directories given as arguments to supported project files (
README.md,action.yaml,action.yml,package.json,package-lock.json,build.gradle,build.gradle.kts,gradle.properties,Cargo.toml,Cargo.lock,pyproject.toml,uv.lock,build.zig.zon,gleam.toml,flake.nix,CMakeLists.txt) - skips likely vendored paths (
vendor,node_modules) and symlinks during directory scans - commits the bumped files and pushes them with the new git tag
This works well as a github action. Have it run on every push to main and it will bump the version for every change, or run it on a schedule to increase the version if there were any new changes.
Usage
bumper [paths...]
Why
Most of the popular actions are antagonistic about making any changes to the source code during version bumps. Unfortunately for me, two of the technologies I use quite heavily (nix & npm) use version numbers in source, and I would rather deal with the occasional rebase than have version numbers out of sync. Of those that support bumping versions in source, I didn't find any I liked that also supported bumping for arbitrary files. I've found it quite common to have a version that needs to be updated in a readme, or a hardcoded version in the source code.
Install
Action
- name: Bump
uses: spotdemo4/bumper@v0.16.3
with:
commit: true # commit changes after bumping, default true
push: true # push changes after bumping, default true
force: false # force at least a PATCH version bump, default false
# list of files to bump versions in
files: |-
action.yaml
README.md
# conventional commit types for MAJOR version bumps, default "BREAKING CHANGE"
major_types: |-
BREAKING CHANGE
# conventional commit types for MINOR version bumps, default "feat"
minor_types: |-
feat
# conventional commit types for PATCH version bumps, default "fix"
patch_types: |-
fix
# conventional commit scopes to skip over, default "ci"
skip_scopes: |-
ci
Nix
nix run github:spotdemo4/bumper
Flake
inputs = {
bumper = {
url = "github:spotdemo4/bumper";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { bumper, ... }: {
devShells.x86_64-linux.default = pkgs.mkShell {
packages = [
bumper.x86_64-linux.default
];
};
}
also available from the nix user repository as nur.repos.trev.bumper
Docker
docker run -it \
-w /app \
-v "$(pwd):/app" \
-v "$HOME/.ssh:/root/.ssh" \
ghcr.io/spotdemo4/bumper:0.16.3
Dependencies
| ID | Version |
|---|---|
| clap | ^4 |
| git2 | ^0.21.0 |
| regex | ^1 |
| toml_edit | ^0.25 |