Skip to content

Commit

Permalink
Fix release script to fail if not run from trunk (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
f-f authored May 6, 2021
1 parent 0f38c91 commit b46b85c
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -20,4 +29,4 @@ git tag "${NEW_TAG}"

git push origin "${NEW_TAG}"

echo "Done."
echo "Done."

0 comments on commit b46b85c

Please sign in to comment.