Skip to content

Commit

Permalink
Add build script for gai-frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
danopato committed Dec 3, 2024
1 parent 69a702d commit 20e55fc
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions gai-frontend/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Set default mode to prod if not specified
MODE=${1:-prod}

# Select and export providers based on mode
if [ "$MODE" = "test" ]; then
if [ -z "$ORCHID_GENAI_FRONTEND_PROVIDERS_TEST" ]; then
echo "Error: ORCHID_GENAI_FRONTEND_PROVIDERS_TEST environment variable not set"
exit 1
fi
export PROVIDERS="$ORCHID_GENAI_FRONTEND_PROVIDERS_TEST"
else
if [ -z "$ORCHID_GENAI_FRONTEND_PROVIDERS_PROD" ]; then
echo "Error: ORCHID_GENAI_FRONTEND_PROVIDERS_PROD environment variable not set"
exit 1
fi
export PROVIDERS="$ORCHID_GENAI_FRONTEND_PROVIDERS_PROD"
fi

BUILD_CMD="flutter build web --dart-define=PROVIDERS='$PROVIDERS'"
echo "Executing: $BUILD_CMD"
eval "$BUILD_CMD"

# Clean up
unset PROVIDERS

# Exit with flutter's exit code
exit $?

0 comments on commit 20e55fc

Please sign in to comment.