#! /bin/sh set -e (git branch | grep -q '* master') || { echo "Only release from the master branch." exit 1 } # Delete existing gh-pages branch if [ `git branch --list gh-pages `] then git branch -D gh-pages fi git checkout -b gh-pages rake generate_preview git add . git commit -am 'deploy preview' git push origin gh-pages --force git checkout master