Created
November 9, 2016 18:05
-
-
Save u8sand/403d899d073bec473ac8a582495f28fc to your computer and use it in GitHub Desktop.
github.io-like Jekyll hook
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 | |
| # Note that this goes under your github bare repo /hooks/ | |
| work=$(mktemp -d) | |
| out=/http/ | |
| jekyll=/usr/share/ruby/2.3.0/bin/jekyll | |
| while read oldrev newrev refname | |
| do | |
| branch=`echo $refname | cut -d/ -f3` | |
| if [ "$branch" == "master" ]; then | |
| GIT_WORK_TREE="$work" git checkout -f $branch | |
| $jekyll build -s "$work" -d "$out" | |
| find "$out" -type d -exec setfacl -m "g:http:r-x" {} + | |
| find "$out" -type f -exec setfacl -m "g:http:r--" {} + | |
| fi | |
| done | |
| rm -r "$work" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment