Skip to content

Commit

Permalink
Add additional checks to the release script (#1006)
Browse files Browse the repository at this point in the history
## Test plan
1. do a release
  • Loading branch information
mkondratek authored Mar 13, 2024
1 parent e8b6ac3 commit fc71c43
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions scripts/push-git-tag-for-next-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@
# No arguments needed, the version is automatically computed.
set -eux

# Check if the current branch is 'main'
CURRENT_BRANCH=$(git symbolic-ref --short HEAD)
if [ "$CURRENT_BRANCH" != "main" ]; then
echo "Warning: You are not on the 'main' branch. You are on '$CURRENT_BRANCH'."
# shellcheck disable=SC2162
read -p "Are you sure you want to proceed? (y/n): " proceed
if [ "$proceed" != "y" ]; then
echo "Aborted."
exit 1
fi
fi

# Check if the working tree is clean
if ! git diff-index --quiet HEAD --; then
echo "Error: Your working tree is not clean. Please commit or stash your changes."
exit 1
fi

# Check the number of arguments
if [ "$#" -ne 1 ]; then
echo "Usage: $0 [--major | --minor | --path]"
Expand All @@ -24,7 +42,7 @@ if [ "$NEXT_RELEASE_ARG" == "--major" ]; then
fi

# shellcheck disable=SC2162
read -p "Confirm that you want to run the release v.$NEXT_VERSION (y/n): " choice
read -p "Confirm that you want to run the release v$NEXT_VERSION (y/n): " choice
if [ "$choice" == "y" ]; then
echo "Running release..."
else
Expand All @@ -35,4 +53,4 @@ fi
bash "$SCRIPT_DIR/verify-release.sh"
TAG="v$NEXT_VERSION"
echo "$TAG"
git tag -fa "$TAG" -m "$TAG" && git push -f origin "$TAG"
git tag -fa "$TAG" -m "$TAG" && git push -f origin "$TAG"

0 comments on commit fc71c43

Please sign in to comment.