You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/deploy.sh
+7-5Lines changed: 7 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -2,16 +2,18 @@
2
2
# Executed when the `master` or `staging` branches of PokeAPI/api-data and PokeAPI/pokeapi.co are pushed to
3
3
# Runs in CircleCI
4
4
# Deploys both pokeapi.co and api-data to Firebase in the respective project
5
-
# $FIREBASE_DEPLOY_TOKEN, $FIREBASE_PROJECT_ID, $FIREBASE_DEPLOY_TOKEN_STAGING, $FIREBASE_PROJECT_ID_STAGING are present in CircleCI
5
+
# $GCP_SA, $FIREBASE_PROJECT_ID, $GCP_SA_STAGING, $FIREBASE_PROJECT_ID_STAGING are present in CircleCI
6
6
# $deploy_location is an environment variable set when the job is triggered by one of the two repositories getting pushed. If not present then the deploy was triggered by a commit on the master or staging branch of this very repository.
7
7
8
-
if [ "${deploy_location:=$CIRCLE_BRANCH}"='master' ];then# bash parameter expansion (assign default value)
8
+
GOOGLE_APPLICATION_CREDENTIALS=gcp_sa.json
9
+
10
+
if [ "${deploy_location:=$CIRCLE_BRANCH}"='master' ];then
9
11
echo'Deploying master branches of PokeAPI/api-data and PokeAPI/pokeapi.co to https://pokeapi.co'
10
-
TOKEN=${FIREBASE_DEPLOY_TOKEN}
12
+
echo"$GCP_SA"> gcp_sa.json
11
13
PROJECT=${FIREBASE_PROJECT_ID}
12
14
elif [ "${deploy_location}"='staging' ];then
13
15
echo'Deploying staging branches of PokeAPI/api-data and PokeAPI/pokeapi.co to the staging location'
14
-
TOKEN=${FIREBASE_DEPLOY_TOKEN_STAGING}
16
+
echo"$GCP_SA_STAGING"> gcp_sa.json
15
17
PROJECT=${FIREBASE_PROJECT_ID_STAGING}
16
18
fi
17
19
@@ -35,5 +37,5 @@ tar xzf static_website.tar.gz -C public
35
37
36
38
# Deploy to Firebase
37
39
(cd functions_v1 && npm ci)
38
-
# (cd functions_v2 && npm ci) # Not used due to high costs. When v1 will be sunsetting, switch to v2
40
+
# (cd functions_v2 && npm ci) # Not used due to high costs. Only when v1 will be removed, switch to v2
0 commit comments