From b46b85c335b079df402323ea910da4b0e55ae6d2 Mon Sep 17 00:00:00 2001 From: Fabrizio Ferrai Date: Fri, 7 May 2021 00:05:10 +0300 Subject: [PATCH] Fix release script to fail if not run from trunk (#791) --- release.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/release.sh b/release.sh index f8783f7d0..5ff67e96b 100755 --- a/release.sh +++ b/release.sh @@ -6,11 +6,20 @@ set -euo pipefail # It will create a tag and push it, which will trigger CI to create a release, # build release binaries, push them to the release, and publish a new version on NPM +# Fail if we are not on trunk +BRANCH=$(git branch --show-current) +if [ "${BRANCH}" != "master" ]; then + echo "Please checkout master branch" + exit 1; +fi +git pull + NEW_TAG=$(./scripts/get-version) # Fail if the new tag already exists +# Note: exit status of the command is the conditional if git rev-parse "${NEW_TAG}" >/dev/null 2>&1; then - echo "Tag '${NEW_TAG}' already exists, please bump the version in package.yaml"; + echo "Tag '${NEW_TAG}' already exists, please bump the version in spago.cabal"; exit 1; fi @@ -20,4 +29,4 @@ git tag "${NEW_TAG}" git push origin "${NEW_TAG}" -echo "Done." \ No newline at end of file +echo "Done."