-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathdeploy.sh
executable file
·39 lines (30 loc) · 974 Bytes
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Validate input
if [ -z "$1" ]; then
echo "Error: No subfolder specified."
echo "Usage: $0 <subfolder>"
exit 1
fi
SUBFOLDER=$1
EXTRA_ENV=$2
# Ensure the subfolder exists
if [ ! -d "$SUBFOLDER" ]; then
echo "Error: Subfolder '$SUBFOLDER' does not exist."
exit 1
fi
# Navigate to the subfolder
cd "$SUBFOLDER"
# Print the current working directory for debugging
echo "Deploying content from: $(pwd)"
# Check if reflex CLI is installed
if ! command -v reflex &> /dev/null; then
echo "Error: Reflex CLI not found. Please ensure it is installed."
exit 1
fi
# Store the project ID in a variable
template_id=$(reflex apps project-list --token $REFLEX_AUTH_TOKEN | awk '/templates/ {print $1}')
echo "Starting deployment..."
reflex deployv2 --token $REFLEX_AUTH_TOKEN --project $template_id --no-interactive $EXTRA_ENV
echo "Deployment for '$SUBFOLDER' completed successfully."