diff --git a/justfile b/justfile index 68e9f8f..c79f130 100644 --- a/justfile +++ b/justfile @@ -8,13 +8,14 @@ set quiet set unstable set shell := ["/usr/bin/env", "bash", "-c"] -set script-interpreter := ["/usr/bin/env", "bash", "-c"] +set script-interpreter := ["/usr/bin/env", "bash"] JUST_EXECUTABLE := "just -u -f " + justfile() header := "Available tasks:\n" # Get the MSRV from the Cargo.toml msrv := `cat Cargo.toml | grep "rust-version" | sed 's/.*"\(.*\)".*/\1/'` +export TZ := "UTC" _default: @{{JUST_EXECUTABLE}} --list-heading "{{header}}" --list @@ -25,8 +26,10 @@ ci: && msrv _done_ci cargo build -q echo "๐Ÿ” Checking code formatting..." cargo fmt -q -- --check + taplo fmt --check --config ./.taplo.toml echo "๐Ÿงน Running linter checks..." cargo clippy -q -- -D warnings + taplo check --config ./.taplo.toml # Check that the current MSRV is correct msrv: @@ -39,16 +42,29 @@ _done_ci: # Update the changelog [script] -change-log: +changelog: OLD_HASH=$(sha256sum CHANGELOG.md | head -c 64) git-cliff > CHANGELOG.md NEW_HASH=$(sha256sum CHANGELOG.md | head -c 64) if [[ $OLD_HASH != $NEW_HASH ]]; then - TZ=UTC git add CHANGELOG.md - TZ=UTC git commit -m 'chore(changelog): Update the changelog' + git add CHANGELOG.md + git commit -m 'chore(changelog): Update the changelog' echo 'The changes have been added to the changelog file and committed' else echo 'No changes have been added to the changelog' fi -alias cl := change-log +# Releases a new version of n34. Requires a clean file tree with no uncommitted changes. +[script] +release version: + set -e + TAG_MSG=$(git-cliff --strip all --unreleased --tag "v{{ version }}" | sed -e 's/[]#[]//g' -e 's/^ //g') + sed -i "s/^version\s*= \".*\"/version = \"{{ version }}\"/" ./Cargo.toml + taplo fmt --config ./.taplo.toml ./Cargo.toml + {{ JUST_EXECUTABLE }} ci + git-cliff -t "v{{ version }}" > CHANGELOG.md + git add . + git commit -m 'chore: Bump the version to `v{{ version }}`' + git tag -s -m "$TAG_MSG" "v{{ version }}" + git push origin master --tags + cargo publish