github.com/jmitchell/nomad@v0.1.3-0.20151007230021-7ab84c2862d8/scripts/website_push.sh (about)

     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/nomad-www-XXXXXX`
    11  trap "rm -rf $DEPLOY" INT TERM EXIT
    12  
    13  # Get the parent directory of where this script is.
    14  SOURCE="${BASH_SOURCE[0]}"
    15  while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
    16  DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
    17  
    18  # Copy into tmpdir
    19  cp -R $DIR/website/ $DEPLOY/
    20  
    21  # Change into that directory
    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:nomad-www.git
    35  git push -f heroku master
    36  
    37  # Go back to our root
    38  popd &>/dev/null