github.com/underarmour/terraform@v0.6.7-0.20151214142642-e159649486f4/scripts/website_push.sh (about) 1 #!/bin/bash 2 3 # Switch to the stable-website branch 4 git checkout stable-website 5 6 # Set the tmpdir 7 if [ -z "$TMPDIR" ]; then 8 TMPDIR="/tmp" 9 fi 10 11 # Create a temporary build dir and make sure we clean it up. For 12 # debugging, comment out the trap line. 13 DEPLOY=`mktemp -d $TMPDIR/terraform-www-XXXXXX` 14 trap "rm -rf $DEPLOY" INT TERM EXIT 15 16 # Get the parent directory of where this script is. 17 SOURCE="${BASH_SOURCE[0]}" 18 while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done 19 DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )" 20 21 # Copy into tmpdir 22 shopt -s dotglob 23 cp -r $DIR/website/* $DEPLOY/ 24 25 # Change into that directory 26 pushd $DEPLOY &>/dev/null 27 28 # Ignore some stuff 29 touch .gitignore 30 echo ".sass-cache" >> .gitignore 31 echo "build" >> .gitignore 32 echo "vendor" >> .gitignore 33 34 # Add everything 35 git init -q . 36 git add . 37 git commit -q -m "Deploy by $USER" 38 39 git remote add heroku git@heroku.com:terraform-www.git 40 git push -f heroku master 41 42 # Go back to our root 43 popd &>/dev/null