From 85c66d47496e8d576cbaf17ac794b369bb053320 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Sun, 20 Sep 2015 14:03:38 -0400 Subject: [PATCH] Use a faster middleman deploy --- scripts/website_push.sh | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/scripts/website_push.sh b/scripts/website_push.sh index 1371eebb6b..dbd070d659 100755 --- a/scripts/website_push.sh +++ b/scripts/website_push.sh @@ -1,17 +1,38 @@ #!/bin/bash +# Set the tmpdir +if [ -z "$TMPDIR" ]; then + TMPDIR="/tmp" +fi + +# Create a temporary build dir and make sure we clean it up. For +# debugging, comment out the trap line. +DEPLOY=`mktemp -d $TMPDIR/consul-www-XXXXXX` +trap "rm -rf $DEPLOY" INT TERM EXIT + # Get the parent directory of where this script is. SOURCE="${BASH_SOURCE[0]}" while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )" +# Copy into tmpdir +cp -R $DIR/website/ $DEPLOY/ + # Change into that directory -cd $DIR +pushd $DEPLOY &>/dev/null -# Add the git remote if it doesn't exist -git remote | grep heroku || { - git remote add heroku git@heroku.com:consul-www.git -} +# Ignore some stuff +touch .gitignore +echo ".sass-cache" >> .gitignore +echo "build" >> .gitignore -# Push the subtree (force) -git push heroku `git subtree split --prefix website master`:master --force +# Add everything +git init -q . +git add . +git commit -q -m "Deploy by $USER" + +git remote add heroku git@heroku.com:consul-www.git +git push -f heroku master + +# Go back to our root +popd &>/dev/null