From d3291345dfa5c512904bea39e834418620b6f317 Mon Sep 17 00:00:00 2001 From: Don Isaac Date: Wed, 18 Sep 2024 15:58:00 -0400 Subject: [PATCH] build: add release script to Justfile --- Justfile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Justfile b/Justfile index e536539..857cad9 100644 --- a/Justfile +++ b/Justfile @@ -4,6 +4,8 @@ _default: alias f := fix alias l := lint +version := `tq -f Cargo.toml 'package.version'` + # Install tools needed for development. Make sure cargo-binstall is installed first. init: cargo binstall cargo-shear taplo-cli typos-cli -y @@ -25,3 +27,23 @@ fix: cargo clippy --no-deps --all-targets --all-features --fix --allow-staged just fmt git status + +# Make a release. `semver_kind` is major/minor/patch +# +# requires these tools: +# - cargo-bump: https://github.com/wraithan/cargo-bump +# - tomlq: https://github.com/cryptaliagy/tomlq +release semver_kind: + # bail on uncommitted changes + git diff --exit-code --name-only + # replace package.version in Cargo.toml + cargo bump {{semver_kind}} + # update Cargo.lock + cargo check + @echo Creating release: {{version}} + git add Cargo.toml Cargo.lock + git commit -m "release: {{version}}" + git tag v{{version}} + git push --tags + cargo publish +