-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·34 lines (29 loc) · 1.19 KB
/
deploy.sh
File metadata and controls
executable file
·34 lines (29 loc) · 1.19 KB
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
#!/bin/bash
# Load environment variables
if [ -f .env ]; then
echo "Loading environment variables from .env..."
set -a # automatically export all variables
source .env
set +a # stop automatically exporting
else
echo "Warning: .env file not found!"
fi
# Build the project
echo "Building project..."
yarn build
# Create package.json for deployment
echo "Preparing deployment package..."
cp package.deploy.json dist/package.json
cp yarn.lock dist/
# Deploy to Google Cloud Functions (deploy directly from dist)
echo "Deploying to Google Cloud Functions..."
gcloud functions deploy cms-data-visualizer \
--runtime=nodejs22 \
--region=asia-northeast1 \
--source=./dist \
--entry-point=items \
--trigger-http \
--allow-unauthenticated \
--set-env-vars="REEARTH_CMS_INTEGRATION_API_BASE_URL=$REEARTH_CMS_INTEGRATION_API_BASE_URL,REEARTH_CMS_INTEGRATION_API_ACCESS_TOKEN=$REEARTH_CMS_INTEGRATION_API_ACCESS_TOKEN,REEARTH_CMS_PROJECT_ID=$REEARTH_CMS_PROJECT_ID,REEARTH_CMS_MODEL_ID=$REEARTH_CMS_MODEL_ID,REEARTH_CMS_WORKSPACE_ID=$REEARTH_CMS_WORKSPACE_ID,API_SECRET_KEY=$API_SECRET_KEY,CORS_ORIGIN=$CORS_ORIGIN"
echo "Deployment complete!"
echo "Your function URL will be displayed above."