From 4a5821759f5fd3b967ae3ff9dc22f8fdfedd1eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Wed, 10 Jul 2024 09:22:10 +0100 Subject: [PATCH] fix: reject non-semver strings in release.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fail when the next version is specified as a non-semver string, e.g. "minor" or "patch". Signed-off-by: Miroslav Bajtoš --- release.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/release.sh b/release.sh index d395c0e..9c128d5 100755 --- a/release.sh +++ b/release.sh @@ -5,6 +5,11 @@ git diff --quiet HEAD || (echo "please revert the uncommited changes"; exit 1) SPARK_VERSION="${1?Missing required argument: semver}" +(echo "$SPARK_VERSION" | grep -Eq '^\d+\.\d+\.\d+$') || { + echo Invalid version string \'$SPARK_VERSION\'. Must be MAJOR.MINOR.PATCH + exit 1 +} + sed -i '' -e "s/SPARK_VERSION = .*/SPARK_VERSION = '$SPARK_VERSION'/" lib/constants.js git add lib/constants.js git commit -m v"$SPARK_VERSION"