Skip to content

Instantly share code, notes, and snippets.

@thrau
Last active October 29, 2020 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thrau/2560ecbb7fd8c573202b4fa13024cd38 to your computer and use it in GitHub Desktop.
Save thrau/2560ecbb7fd8c573202b4fa13024cd38 to your computer and use it in GitHub Desktop.
git post receive hook for building jekyll website remotely
#!/bin/bash
#
# An example hook script to make use of push options.
# The example simply echoes all push options that start with 'echoback='
# and rejects all pushes when the "reject" push option is used.
#
# To enable this hook, rename this file to "pre-receive".
set -e
echo "[jekyll-hook] updating worktree"
cd /home/thomas/www-git-thrau-at/worktree
git --git-dir=$PWD/.git fetch origin
git --git-dir=$PWD/.git reset --hard origin/master
echo "[jekyll-hook] running jekyll build"
bundle config set --local path 'vendor/bundle'
bundle exec jekyll build
echo "[jekyll-hook] updating web files"
rsync -q -av /home/thomas/www-git-thrau-at/worktree/_site/ /home/thomas/www-thrau.at
echo "[jekyll-hook] done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment