Crates.io | git-semversion |
lib.rs | git-semversion |
version | 0.0.2 |
source | src |
created_at | 2024-07-03 03:12:13.17508 |
updated_at | 2024-07-03 03:22:52.401676 |
description | Generate a semantic versioning compliant tag for your HEAD commit. |
homepage | https://github.com/nicholaschiasson/git-semver |
repository | https://github.com/nicholaschiasson/git-semver |
max_upload_size | |
id | 1290136 |
size | 39,718 |
Generate a semantic versioning compliant tag for your HEAD commit.
This project also publishes a binary application for use on the command line.
For now, crates.io is the only place this is being distributed.
cargo install git-semversion
Generate a semantic versioning compliant tag for your HEAD commit
Usage: git-semver [OPTIONS]
Options:
-m, --main-branch <MAIN_BRANCH>
The name of your repository's main branch. Useful if you continue to use "master" or "trunk" [default: main]
-p, --prerelease-id <PRERELEASE_ID>
Identifier to use for prerelease during non-main branch execution, using branch name slug when omitted
-r, --prerelease-revision <PRERELEASE_REVISION>
Revision to use for prerelease during non-main branch execution, using short commit hash when omitted
-i, --increment <INCREMENT>
Explicit increment level override for use during main branch execution, forcing to ignore the increment level derived from commit summary [possible values: patch, minor, major]
--default-increment <DEFAULT_INCREMENT>
Increment level override for non-merge commits to main branch, ie. commits directly to main branch [default: patch] [possible values: patch, minor, major]
-e, --match-expression <MATCH_EXPRESSION>
Regular expression to match the increment level in the commit summary of a commit to the main branch [default: "^Merge .*(patch|minor|major)/[\\w-]+"]
-h, --help
Print help
-V, --version
Print version
This project also publishes a docker image, exposing the CLI tool.
You can pull the image from GitHub's container registry:
docker pull ghcr.io/nicholaschiasson/git-semver:latest
Or for more convenience, you can reference the image in a docker compose file:
---
services:
git-semver:
image: ghcr.io/nicholaschiasson/git-semver:latest
volumes:
- .:/repo:ro
For extra convenience, you can create an alias to the docker compose command:
echo 'alias git-semver="docker compose --file path/to/docker-compose.yml run --rm git-semver"' >> "${HOME}/.bashrc"
source "${HOME}"/.bashrc
After that, you should be able to simply run git-semver
to invoke the container.
The docker image entrypoint is the git-semver CLI binary itself, meaning the usage is the exact same as indicated above.
Create the development shell environment. Necessary to run all other commands.
nix develop
Build with cargo.
just build
Check the code with cargo's built-in fast static analysis.
just check
Remove build files.
just clean
Format the code.
just format
Check the code with clippy for better static analysis.
just lint
Run the application.
just run
Run tests with cargo's built-in test runner.
just test
Watch for code changes and rebuild.
just watch
All just
commands can accept additional command line arguments after a --
.
For example: run the application with a flag to report the version.
just run -- --version
To get linking to rust binaries in your IDE, you should open the development shell from your terminal and then open your IDE from that shell session. This will carry over the development shell's environment into your IDE.
For example if you work with VSCode.
cd path/to/this/project
nix develop
code .
By doing this, you can install the rust-analyzer VSCode extension and it will work properly since it will be able to point to the correct rust binaries and libraries. You will also have access in VSCode to any packages installed by the nix flake.