I write these posts locally on my development machine and commit them to the local Git repository. One simple way of publishing the blog is to build the site locally and then copy the static files to my webserver.

A more automated approach is by using a Git hook. I use Git both locally and on my server to keep things safe. On every commit, the post-receive hook is run. This runs a simple script which I found somewhere on the web (remind myself to write down such links in the future!)

#!/bin/sh
DEPLOY_TMP_DIR=$(mktemp /home/nimerritt/tmp/jekyll.deploy.XXXXX)
REPOSITORY_DIR="/home/nimerritt/repos/home.git"
DEPLOY_DIR="/home/nimerritt/webapps/home"

rm -f $DEPLOY_TMP_DIR
git clone $REPOSITORY_DIR $DEPLOY_TMP_DIR
cd $DEPLOY_TMP_DIR
jekyll build -d $DEPLOY_DIR
rm -rf $DEPLOY_TMP_DIR