Merge pull request #2812 from mitchellh/sethvargo/faster_deploy
Use a faster deploy script
This commit is contained in:
commit
4f59480adb
|
@ -1,12 +1,40 @@
|
|||
#!/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/packer-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 )"
|
||||
|
||||
# Change into that directory
|
||||
cd $DIR
|
||||
# Copy into tmpdir
|
||||
shopt -s dotglob
|
||||
cp -r $DIR/website/* $DEPLOY/
|
||||
|
||||
# Push the subtree (force)
|
||||
git push heroku `git subtree split --prefix website master`:master --force
|
||||
# Change into that directory
|
||||
pushd $DEPLOY &>/dev/null
|
||||
|
||||
# Ignore some stuff
|
||||
touch .gitignore
|
||||
echo ".sass-cache" >> .gitignore
|
||||
echo "build" >> .gitignore
|
||||
echo "vendor" >> .gitignore
|
||||
|
||||
# Add everything
|
||||
git init -q .
|
||||
git add .
|
||||
git commit -q -m "Deploy by $USER"
|
||||
|
||||
git remote add heroku git@heroku.com:packer-www.git
|
||||
git push -f heroku master
|
||||
|
||||
# Go back to our root
|
||||
popd &>/dev/null
|
||||
|
|
Loading…
Reference in New Issue