Created
January 31, 2017 21:51
-
-
Save theburningmonk/4d3ee3ffb7f7d8d71d6529f3ae69daf6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
set -e | |
set -o pipefail | |
echo '***Start***' | |
INSTRUCTION="If you want to deploy, try running the script with 'deploy stage region profile', e.g. 'deploy dev eu-west-1 non-prod'" | |
if [ $# -eq 0 ]; then | |
echo "Missing arguments." | |
echo $INSTRUCTION | |
exit 1 | |
elif [ "$1" = "integration" ] && [ $# -eq 4 ]; then | |
STAGE=$2 | |
REGION=$3 | |
PROFILE=$4 | |
npm install | |
LOCAL=true AWS_PROFILE=$PROFILE npm run integration-$STAGE | |
elif [ "$1" = "acceptance" ] && [ $# -eq 4 ]; then | |
STAGE=$2 | |
REGION=$3 | |
PROFILE=$4 | |
npm install | |
LOCAL=true AWS_PROFILE=$PROFILE npm run acceptance-$STAGE | |
elif [ "$1" = "deploy" ] && [ $# -eq 4 ]; then | |
STAGE=$2 | |
REGION=$3 | |
PROFILE=$4 | |
npm install | |
UPPER_STAGE=$(echo $STAGE | tr 'a-z' 'A-Z') | |
echo "AWS_$UPPER_STAGE""_PROFILE=$PROFILE" > admin.env | |
sls resources deploy -s $STAGE -r $REGION | |
sls function deploy -s $STAGE -r $REGION | |
sls endpoint deploy -s $STAGE -r $REGION | |
else | |
echo $INSTRUCTION | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment