Skip to content

Instantly share code, notes, and snippets.

@jefferis
Last active August 29, 2015 14:16
Show Gist options
  • Save jefferis/bc07c339606c0a65b411 to your computer and use it in GitHub Desktop.
Save jefferis/bc07c339606c0a65b411 to your computer and use it in GitHub Desktop.
jekyll on flybrain
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
# Jekyll update code
# always runs in .git dir
GIT_REPO=$PWD
REPO=`basename "${GIT_REPO}" | sed s/\.git$// `
TMP_GIT_CLONE=$HOME/tmp/$REPO
PUBLIC_WWW=/var/www/$REPO
export BUNDLE_PATH=$HOME/bundle
# clean up just in case
rm -Rf $TMP_GIT_CLONE
git clone $GIT_REPO $TMP_GIT_CLONE
cd $TMP_GIT_CLONE
bundle update
# safe is require for jekyll bootstrap to define BASE_PATH liquid variable
# if missing assets can't be found etc
bundle exec jekyll build --safe -s $TMP_GIT_CLONE -d $PUBLIC_WWW
exit
@jefferis
Copy link
Author

jefferis commented Mar 8, 2015

See http://jekyllrb.com/docs/deployment-methods/#git-post-receive-hook for the background. Updating the bundle every time is probably a bit keen but not too slow at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment