Last active
October 29, 2020 13:47
-
-
Save thrau/2560ecbb7fd8c573202b4fa13024cd38 to your computer and use it in GitHub Desktop.
git post receive hook for building jekyll website remotely
This file contains hidden or 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
#!/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