diff --git a/tools/gae_deploy.sh b/tools/gae_deploy.sh index 87d234b7..3680ebdb 100644 --- a/tools/gae_deploy.sh +++ b/tools/gae_deploy.sh @@ -1,8 +1,18 @@ #!/bin/bash +if [ -z "$GOOGLE_CLOUD_PROJECT" ]; then + read -p "Please input your project ID: " GOOGLE_CLOUD_PROJECT + if [ -z "$GOOGLE_CLOUD_PROJECT" ]; then + echo "Error: Project ID cannot be empty." + exit 1 + fi + export GOOGLE_CLOUD_PROJECT +fi gcloud config set project $GOOGLE_CLOUD_PROJECT -gcloud app create #select a region for app if it's first time -python ./kindleear/tools/update_req.py gae -if [ $? -eq 0 ]; then +if ! gcloud app describe >/dev/null 2>&1; then + gcloud app create #select a region for app if it's first time +fi + +if python ./kindleear/tools/update_req.py gae; then gcloud beta app deploy --version=1 ./kindleear/app.yaml gcloud beta app deploy --quiet --version=1 ./kindleear/worker.yaml gcloud beta app deploy --quiet --version=1 ./kindleear/cron.yaml @@ -11,7 +21,6 @@ if [ $? -eq 0 ]; then echo -e "The deployment is completed." echo -e "The access address is: https://$GOOGLE_CLOUD_PROJECT.appspot.com" else - echo -e "The deployment is terminated." + echo -e "Error: Update requirements failed. The deployment is terminated." exit 1 fi -