Skip to content

Instantly share code, notes, and snippets.

@theburningmonk
Created January 31, 2017 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save theburningmonk/4d3ee3ffb7f7d8d71d6529f3ae69daf6 to your computer and use it in GitHub Desktop.
Save theburningmonk/4d3ee3ffb7f7d8d71d6529f3ae69daf6 to your computer and use it in GitHub Desktop.
#!/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