From 9ca015e42f6807f7e8b7ae8be3675eda46e0c06f Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Wed, 6 Oct 2021 13:22:45 +0200 Subject: [PATCH] Roll back release on git errors --- scripts/commit-release.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/commit-release.sh b/scripts/commit-release.sh index 76e926f1..9ab8af5d 100755 --- a/scripts/commit-release.sh +++ b/scripts/commit-release.sh @@ -10,4 +10,15 @@ DATE=`date "+%Y-%m-%d"` CHANGELOG_GLOB="Passepartout/App/*/CHANGELOG.md" MESSAGE="Release" sed -i '' -E "s/^.*Beta.*$/## $VERSION ($DATE)/" $CHANGELOG_GLOB -git commit -am $MESSAGE && git tag -as "v$VERSION" -m $MESSAGE + +if ! git commit -am $MESSAGE; then + echo "Failed to commit release" + git reset --hard + exit +fi + +if ! git tag -as "v$VERSION" -m $MESSAGE; then + echo "Failed to tag release" + git reset --hard HEAD^ + exit +fi