wlo/scripts/githook.post-receive
Sebastian Kuzminsky 5c5754abd8 ignore the scripts
2015-11-08 19:38:48 -07:00

33 lines
646 B
Bash
Executable file

#!/bin/bash
GIT_REPO=/home/seb/wlo.git
WEBSITE=/home/seb/public_html/linuxcnc/wlo
RETVAL=0
while read FROM TO REF; do
echo "stdin: from=$FROM to=$TO ref=$REF"
if [ "$REF" != "refs/heads/master" ]; then
continue
fi
#
# updating master branch, build the site
#
BUILD_DIR=$(mktemp --directory)
git clone $GIT_REPO $BUILD_DIR
cd $BUILD_DIR
jekyll build --quiet --trace
if [ $? -ne 0 ]; then
# jekyll failed to build the site
RETVAL=1
else
# jekyll suceeded
rsync --archive --quiet $BUILD_DIR/_site/ $WEBSITE
fi
rm -rf $BUILD_DIR
done
exit $RETVAL