forked from xraypy/xraylarch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish_docs.sh
54 lines (47 loc) · 998 Bytes
/
publish_docs.sh
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
docdir='doc'
name='larch'
finish() {
echo "# git checkout master"
git checkout master
if [ $? -ne 0 ] ; then
echo '# git checkout master failed.'
exit
fi
}
cd $docdir
echo '# Making docs'
make clean
make html pdf
cd _build/html
tar czf ../../../_docs.tgz *
cd ../../../
#
echo "# Switching to gh-pages branch"
git checkout gh-pages
git pull
if [ $? -ne 0 ] ; then
echo '# git pull on gh-pages branch failed.'
finish
fi
tar xzf _docs.tgz
echo "# commit changes to gh-pages branch"
git add *.html */*.html larch.pdf
git add *.js objects.inv searchindex.js
git add _sources/ _static/ _images/ _images/math
git commit -am "updated docs"
if [ $? -ne 0 ] ; then
echo '# git commit of all doc changes failed.'
finish
fi
echo "# Pushing docs to github"
git push
if [ $? -ne 0 ] ; then
echo '# git push failed.'
finish
fi
echo "# switch back to master branch"
git checkout master
if [ $? -ne 0 ] ; then
echo '# checkout master failed.'
finish
fi