Skip to content

Commit 3f242df

Browse files
committed
chore: deploy staging branch
1 parent c3ed505 commit 3f242df

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

.circleci/config.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- checkout
2828
- run:
2929
name: Deploy website and api-data to the correct environment (production/staging)
30-
command: sh -x scripts/deploy.sh
30+
command: sh scripts/deploy.sh
3131

3232
workflows:
3333
version: 2
@@ -42,4 +42,6 @@ workflows:
4242
- test
4343
filters:
4444
branches:
45-
only: master
45+
only:
46+
- master
47+
- staging

scripts/deploy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# Runs in CircleCI
44
# Deploys both pokeapi.co and api-data to Firebase in the respective project
55
# $FIREBASE_DEPLOY_TOKEN, $FIREBASE_PROJECT_ID, $FIREBASE_DEPLOY_TOKEN_STAGING, $FIREBASE_PROJECT_ID_STAGING are present in CircleCI
6-
# $deploy_location is an environment variable set when the job is triggered by one of the two repositories getting pushed
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 of staging branch of this very repository.
77

8-
if [ "${deploy_location:=master}" = 'master' ]; then # https://stackoverflow.com/a/2013589/3482533
8+
if [ "${deploy_location:=$CIRCLE_BRANCH}" = 'master' ]; then # bash parameter expansion (assign default value)
99
echo 'Deploying master branches of PokeAPI/api-data and PokeAPI/pokeapi.co to https://pokeapi.co'
1010
TOKEN=${FIREBASE_DEPLOY_TOKEN}
1111
PROJECT=${FIREBASE_PROJECT_ID}

0 commit comments

Comments
 (0)