From 90d7dc3cf4da45f14645527695efba19bd3305ba Mon Sep 17 00:00:00 2001 From: Nick Groenen Date: Sun, 3 Dec 2023 17:33:59 +0100 Subject: [PATCH] Update make-new-release.sh --- make-new-release.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/make-new-release.sh b/make-new-release.sh index 5777b7c..103c926 100755 --- a/make-new-release.sh +++ b/make-new-release.sh @@ -17,18 +17,28 @@ get_next_version_number() { done } -VERSION=$(get_next_version_number) +git add . +if ! git diff-index --quiet HEAD; then + printf "Working directory is not clean. Please commit or stash your changes.\n" + exit 1 +fi -sed -i -E "s/^version = \".+\"$/version = \"${VERSION}\"/" Cargo.toml -cargo check -git commit "Cargo.*" --message "Release v${VERSION}" +VERSION=$(get_next_version_number) git tag "v${VERSION}" git cliff --latest --prepend CHANGELOG.md > /dev/null ${EDITOR:-vim} CHANGELOG.md docs/generate.sh -git add CHANGELOG.md README.md -git commit --amend --no-edit + +sed -i -E "s/^version = \".+\"$/version = \"${VERSION}\"/" Cargo.toml +cargo check + +git add . +# There are likely trailing whitespace changes in the changelog, but a single +# run of pre-commit will fix these automatically. +pre-commit run || git add . + +git commit --message "Release v${VERSION}" git tag "v${VERSION}" --force printf "\n\nSuccessfully created release %s\n" "v${VERSION}"