From f62c58a7f059e452587e63a76ad8ea5c9ba2a4ce Mon Sep 17 00:00:00 2001 From: Travis Finkenauer Date: Sun, 25 Feb 2024 12:20:20 -0800 Subject: [PATCH] tag_release: check for uncommitted changes --- scripts/tag_release.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/tag_release.sh b/scripts/tag_release.sh index d80c099b..4e906475 100755 --- a/scripts/tag_release.sh +++ b/scripts/tag_release.sh @@ -6,10 +6,17 @@ set -eu cd "$(dirname $0)/.." +Error() { + echo "Error:" "$@" >&2 + exit 1 +} + extract_toml_value() { grep "^$1" Cargo.toml | sed 's/^[^ =].*=.*"\([^"]\+\)"$/\1/' | head -n1 } +git diff --exit-code HEAD || Error "Uncommitted changes" + PACKAGE_NAME="$(extract_toml_value name)" PACKAGE_VERSION="${PACKAGE_VERSION:-$(extract_toml_value version)}" DESCRIPTION="${PACKAGE_NAME} v${PACKAGE_VERSION}"