-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-release.sh
executable file
·38 lines (31 loc) · 1.17 KB
/
deploy-release.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
#!/bin/bash
set -e
PROJECT_ID="crypto-gpt-69"
REGION="europe-west1"
# Check if the user is logged in
if [[ $(gcloud auth list --filter=status:ACTIVE --format="value(account)") == "" ]]; then
echo "You're not logged in. Doing that now..."
gcloud auth application-default login --scopes="https://www.googleapis.com/auth/spreadsheets,https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/cloud-platform"
fi
gcloud config set project $PROJECT_ID
# Submit a new build to Cloud Build
BUILD_ID=$(gcloud builds submit --config cloudbuild.yaml . --async --format="value(id)" --region $REGION)
echo "Deployment started (Build ID: $BUILD_ID)."
echo ""
echo "Streaming build logs:"
gcloud beta builds log $BUILD_ID --region $REGION --stream
# Polling the build status
while : ; do
BUILD_STATUS=$(gcloud builds describe $BUILD_ID --region $REGION --format="value(status)")
if [[ $BUILD_STATUS != "WORKING" && $BUILD_STATUS != "QUEUED" ]]; then
break
fi
echo "Build is still in progress... checking again in 10 seconds."
sleep 10
done
if [[ $BUILD_STATUS == "SUCCESS" ]]; then
echo "Deploy successful"
else
echo "DEPLOY FAILED"
exit 1
fi