From 52c81612cf91b80cef68f5c2900ccc30f06fefc4 Mon Sep 17 00:00:00 2001 From: Mraveux Date: Wed, 27 Nov 2024 23:25:54 -0600 Subject: [PATCH] Fix deploy.sh script errors & implement feedback --- deploy.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/deploy.sh b/deploy.sh index ac4c7086..58bd2aaa 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,7 +1,8 @@ #!/bin/bash # Exit on error -set -e +set -eu +set -o pipefail # Color definitions RED='\033[0;31m' @@ -61,6 +62,7 @@ SYNC_TRANSLATIONS=true BUILD_ENV="" DEPLOY_ONLY=false SAME_AS="" +VERSION_PROVIDED_BY_USER=false # Define deploy servers for different environments MAINNET_SERVERS=("deploy_${APP_NAME}@web-1" "deploy_${APP_NAME}@web-2" "deploy_${APP_NAME}@web-3" "deploy_${APP_NAME}@web-4") @@ -303,16 +305,11 @@ fi # Get up-to-date EBA RT1 bank list (disabled while OASIS is not available) # yarn utils:getBankList -# Get up-to-date browsers support list from caniuse. -# The browserslist utility is meant to run via npx, even when usually using yarn, and is compatible with yarn.lock. -echo -e "${CYAN}Updating browsers support list...${NC}" -run_command "yarn update-browserslist" "Failed to update browsers list" - # Check for uncommitted changes -# if [[ `git status --porcelain` ]]; then -# echo -e "${RED}ERROR: The repository has uncommitted changes. Commit them first, then run again.${NC}" -# exit 1 -# fi +if [[ `git status --porcelain` ]]; then + echo -e "${RED}ERROR: The repository has uncommitted changes. Commit them first, then run again.${NC}" + exit 1 +fi # Function to create commit/tag message create_message() { @@ -343,14 +340,14 @@ fi # Build the project echo -e "${BLUE}Building project with $BUILD_ENV configuration...${NC}" -run_command "env \"build=$BUILD_ENV\" yarn build" "Failed to build project" +run_command "yarn build $BUILD_ENV" "Failed to build project" # Deploy to deployment repository echo -e "${BLUE}Deploying to $DEPLOYMENT_REPO...${NC}" run_command "cd \"$DEPLOYMENT_REPO\" || exit 1" "Failed to change to deployment directory" # Checkout appropriate branch and pull latest changes -DEPLOY_BRANCH=$([ "$BUILD_ENV" = "mainnet" ] && echo "mainnet" || echo "testnet") +DEPLOY_BRANCH=$([ "$BUILD_ENV" = "mainnet" ] && echo "master" || echo "testnet") echo -e "${CYAN}Checking out $DEPLOY_BRANCH branch...${NC}" run_command "git checkout $DEPLOY_BRANCH" "Failed to checkout branch" run_command "git pull" "Failed to pull latest changes"