#!/bin/bash # Define the path to the .env.uat file ENV_FILE_PATH=".env.uat" # Check if the .env.uat file exists if [ ! -f $ENV_FILE_PATH ]; then echo "$ENV_FILE_PATH does not exist" exit 1 fi # Copy the .env.uat file to .env cp $ENV_FILE_PATH .env echo "Copied $ENV_FILE_PATH to .env" # Verify .env file contains correct values source .env if [ -z "$BASE_HREF" ]; then echo "BASE_HREF value is empty" exit 1 fi if [ -z "$API_URL" ]; ]; then echo "API_URL value is empty" exit 1 fi # Print loaded values for verification echo "Loaded BASE_HREF: $BASE_HREF" echo "Loaded API_URL: $API_URL" # Build the web app for UAT with base href flutter build web --release --base-href "$BASE_HREF" --dart-define=ENV=uat # Check if the build was successful if [ $? -ne 0 ]; then echo "Flutter UAT build failed" exit 1 fi echo "Flutter UAT build succeeded"