Created
May 18, 2012 16:20
-
-
Save davidmfoley/2726188 to your computer and use it in GitHub Desktop.
Deploy octopress to heroku without crufting your repo with generated files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# For octopress/heroku: generate site, deploy, and tag as "deploy-yyyy-mm-dd" | |
# This allows you to keep your public/ assets out of git, | |
# and only add them just before deploying | |
BRANCH=`git symbolic-ref -q HEAD | sed 's/refs\/heads\///'` | |
SHA=`git rev-parse --short HEAD` | |
echo 'deploying branch:' | |
echo $BRANCH | |
# in case we killed this script previously | |
git branch -D deploy | |
# (you could also git stash here) | |
git co -b deploy | |
# build all the things | |
rake generate | |
# add generated stuff (force because it's .gitignored) | |
git add -f public | |
# commit and tag | |
git ci -m "generate site for heroku deployment" | |
git tag -f deploy-`date +"%Y-%m-%d"`-$SHA | |
#restore initial state | |
# (you could also git stash apply here, etc.) | |
git co $BRANCH | |
git push -f heroku deploy:master | |
git branch -D deploy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment