wlo/scripts/pull-build-rsync
2015-11-08 22:14:27 -07:00

51 lines
873 B
Bash
Executable file

#!/bin/bash
#set -x
RSYNC_DEST=emcboard@www.linuxcnc.org:www.linuxcnc.org/new
#
# build the site
#
./scripts/update-version
jekyll build --trace || exit 1
#
# upload it to wlo
#
rsync -e 'ssh -i /home/seb/.ssh/wlo' --archive --verbose _site/ $RSYNC_DEST
#
# wait for new commits to show up in the git repo
#
while : ; do
git fetch -t origin
MASTER_SHA=$(git rev-parse master)
ORIGIN_MASTER_SHA=$(git rev-parse origin/master)
if [ $MASTER_SHA = $ORIGIN_MASTER_SHA ]; then
echo "$(date +'%F %T') master and origin/master are the same, nothing to do"
sleep 60
else
echo "$(date +'%F %T') new commits in origin/master!"
break
fi
done
#
# new commits are available, and have been fetched into this repo
#
git reset --hard
git checkout master
git reset --hard origin/master
exec scripts/pull-build-rsync