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}"