Last active
August 19, 2017 18:25
-
-
Save rocx/3f7572e0d03aca342d6d55b55f8eac36 to your computer and use it in GitHub Desktop.
Git hook to publish a la Jekyll
This file contains 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
#!/usr/bin/env sh | |
# post-receive - build the site after a push | |
# TODO: a pre-something hook to check if it would build. | |
# TODO: change this hook to checking if the produced markup is valid. | |
# more or less the hook from http://jekyllrb.com/docs/deployment-methods/ | |
REPO=/var/www/repos/my-site.git | |
TEMP=`mktemp -dt site-XXXXXX` | |
SITE=/var/www/my-site | |
(cd ${REPO} && git archive HEAD) | TAPE=- tar -xC ${TEMP} | |
jekyll build -s ${TEMP} -d ${SITE} | |
rm -rf ${TEMP} | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment