Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix DEPLOY_ENV in non-production environments
- Loading branch information
David Clark
committed
Jun 10, 2018
1 parent
6a094da
commit 77977e9
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Establish environment variables based on the branch name. | ||
# | ||
# This is an sh script (instead of Node or bash) because it needs to run in the | ||
# top-level process so the environment variables it creates are available to | ||
# all children processes (e.g. `x && y && z`). `npm run` executes in an `sh` | ||
# environment -- so, sh it is. | ||
|
||
# `git symbolic-ref HEAD` outputs `refs/head/{your-branch-name}`. | ||
branch=`git symbolic-ref HEAD | sed "s/refs\/heads\/\(.*\)/\1/"` | ||
|
||
if [ -z "$DEPLOY_ENV" ] | ||
then | ||
if [ "$branch" = "mb-pages" ] | ||
then | ||
export DEPLOY_ENV=production | ||
else | ||
export DEPLOY_ENV=staging | ||
fi | ||
fi | ||
|
||
echo "DEPLOY_ENV set to $DEPLOY_ENV" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters