Skip to content

Commit e7f33bf

Browse files
committed
Merge pull request hashicorp#3291 from hashicorp/sethvargo/faster_deploy
Use a faster middleman deploy
2 parents 25bba59 + 3e7e323 commit e7f33bf

1 file changed

Lines changed: 30 additions & 4 deletions

File tree

scripts/website_push.sh

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,38 @@
1-
#!/usr/bin/env bash
1+
#!/bin/bash
2+
3+
# Set the tmpdir
4+
if [ -z "$TMPDIR" ]; then
5+
TMPDIR="/tmp"
6+
fi
7+
8+
# Create a temporary build dir and make sure we clean it up. For
9+
# debugging, comment out the trap line.
10+
DEPLOY=`mktemp -d $TMPDIR/terraform-www-XXXXXX`
11+
trap "rm -rf $DEPLOY" INT TERM EXIT
212

313
# Get the parent directory of where this script is.
414
SOURCE="${BASH_SOURCE[0]}"
515
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
616
DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
717

18+
# Copy into tmpdir
19+
cp -R $DIR/website/ $DEPLOY/
20+
821
# Change into that directory
9-
cd $DIR
22+
pushd $DEPLOY &>/dev/null
23+
24+
# Ignore some stuff
25+
touch .gitignore
26+
echo ".sass-cache" >> .gitignore
27+
echo "build" >> .gitignore
28+
29+
# Add everything
30+
git init -q .
31+
git add .
32+
git commit -q -m "Deploy by $USER"
33+
34+
git remote add heroku git@heroku.com:terraform-www.git
35+
git push -f heroku master
1036

11-
# Push the subtree (force)
12-
git push heroku `git subtree split --prefix website HEAD`:master --force
37+
# Go back to our root
38+
popd &>/dev/null

0 commit comments

Comments
 (0)