1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#!/bin/bash
# get git hash for commit message
GITHASH=$(git rev-parse HEAD)
MSG="doc build for commit $GITHASH"
cd _build
# clone the repo if needed
if test -d altair-viz.github.io;
then echo "using existing cloned altair directory";
else git clone https://github.com/altair-viz/altair-viz.github.io.git;
fi
# sync the website
cd altair-viz.github.io
git pull
# remove all tracked files
git ls-files -z | xargs -0 rm -f
# sync files from html build
rsync -r ../html/ ./
# add commit, and push to github
git add . --all
git commit -m "$MSG"
git push origin master
|