2014-10-20 09:00:20 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# go to root
|
|
|
|
cd `dirname $0`
|
|
|
|
cd ..
|
|
|
|
|
2014-10-31 11:03:16 -04:00
|
|
|
if [ "$#" -ne 3 ] || [ "$1" != "prod" ] && [ "$1" != "test" ] ; then
|
|
|
|
echo 'Usage: ./res/aws_release prod|test from-branch 1.0.0'
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2014-10-20 10:41:19 -04:00
|
|
|
# switch branch
|
2014-10-31 11:03:16 -04:00
|
|
|
git checkout $2
|
2015-02-17 07:04:45 -05:00
|
|
|
git branch -D release/$1
|
|
|
|
git checkout -b release/$1
|
2014-10-31 11:03:16 -04:00
|
|
|
git merge $2 --no-edit
|
2014-10-20 10:41:19 -04:00
|
|
|
|
2015-02-20 10:41:38 -05:00
|
|
|
# abort if tests fail
|
|
|
|
set -e
|
|
|
|
|
2014-10-20 09:00:20 -04:00
|
|
|
# build and test
|
|
|
|
rm -rf node_modules/
|
|
|
|
npm cache clear
|
|
|
|
npm install
|
2015-02-13 04:29:40 -05:00
|
|
|
npm test
|
2014-10-31 11:03:16 -04:00
|
|
|
grunt release-$1 --release=$3
|
2014-10-20 09:00:20 -04:00
|
|
|
|
|
|
|
# install only production dependencies
|
|
|
|
rm -rf node_modules/
|
|
|
|
npm install --production
|
|
|
|
|
|
|
|
# delete .gitignore files before adding to git for aws deployment
|
|
|
|
find node_modules/ -name ".gitignore" -exec rm -rf {} \;
|
|
|
|
|
|
|
|
# Add runtime dependencies to git
|
2014-10-22 03:42:42 -04:00
|
|
|
sed -i "" '/dist/d' .gitignore
|
|
|
|
sed -i "" '/node_modules/d' .gitignore
|
|
|
|
git add .gitignore node_modules/ dist/
|
2014-10-31 11:03:16 -04:00
|
|
|
git commit -m "Update release"
|
2014-10-20 09:00:20 -04:00
|
|
|
|
|
|
|
# push to aws
|
2014-10-31 11:03:16 -04:00
|
|
|
eb deploy
|
2014-10-20 10:41:19 -04:00
|
|
|
|
2014-10-31 11:03:16 -04:00
|
|
|
# switch back to $2 branch
|
|
|
|
git checkout $2
|