Deploying a Jekyll Site Via Git Hooks
Hello World.
When deciding on Jekyll for this blog, I wanted a way to automagically deploy updates simply by pushing commits. As it turns out, this is quite easy to accomplish using a small post-update git hook.
$ cat /my/repo/hooks/post-update
echo "Deploying Jekyll Site"
# configure these
REPOSITORY_DIR="/my/repo"
DEPLOY_DIR="/var/www/blog"
# dont edit below here
DEPLOY_TMP_DIR=$(mktemp /tmp/jekyll.deploy.XXXXX)
rm -f $DEPLOY_TMP_DIR
git clone $REPOSITORY_DIR $DEPLOY_TMP_DIR
cd $DEPLOY_TMP_DIR
jekyll $DEPLOY_DIR
rm -rf $DEPLOY_TMP_DIR
Comments