blob: a0976912dd6e7a314842c910abf53a6c46d0155e (
plain)
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
28
29
30
31
32
33
|
#!/usr/bin/env sh
# pick repo for gh-pages branch
repo=origin
if [ ! -d gh-pages ]; then
echo "setting up gh-pages subdir"
mkdir gh-pages || exit -1
cp -r ../.git gh-pages/ || exit -1
cd gh-pages || exit -1
init=0
git checkout $repo/gh-pages || init=1
if [ "$init" != "0" ]; then
echo "initializing gh-pages repo"
git symbolic-ref HEAD refs/heads/gh-pages || exit -1
rm .git/index || exit -1
git clean -fdx || exit -1
touch index.html
git add .
git commit -a -m 'init gh-pages' || exit -1
git push origin HEAD:gh-pages
fi
cd ..
fi
echo "updating local gh-pages with html build"
rsync -va build/html/ gh-pages/ --delete --exclude .git --exclude .nojekyll || exit -1
cd gh-pages
touch .nojekyll
git add .nojekyll
git add .
git commit -a || exit -1
echo "pushing to remote gh-pages"
# pwd
git push $repo HEAD:gh-pages
|