forked from nexusformat/definitions
-
Notifications
You must be signed in to change notification settings - Fork 3
/
jenkins_build
executable file
·78 lines (56 loc) · 2.03 KB
/
jenkins_build
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
set -o errexit -x
# jenkins job name
job_name="$1"
export PATH=/usr/local/bin:$PATH
if test -d build; then
rm -fr build
fi
make builddir
cd build
make
( cd ../impatient-guide && rm -rf _build && make latexpdf && make html )
# publish
if test "${job_name}" = "master branch"; then
## new gh-pages stuff
git_rev=`git rev-parse --short HEAD`
export DIST_ROOT=`pwd`/dist
rm -fr ${DIST_ROOT}
git clone https://github.com/nexusformat/definitions.git --branch gh-pages ${DIST_ROOT}
## need to preserve CNAME file for custom github domain
[ -f ${DIST_ROOT}/CNAME ] && cp -f ${DIST_ROOT}/CNAME /tmp/CNAME.$$
rm -fr ${DIST_ROOT}/*
[ -f /tmp/CNAME.$$ ] && mv /tmp/CNAME.$$ ${DIST_ROOT}/CNAME
mkdir ${DIST_ROOT}/pdf
cd manual
cd source
cp -fr examples ${DIST_ROOT}
cd ..
# be more deliberate about building the PDF
# first, build all intermediate content, indices, etc.
make latex
cd build/latex/
# next, build the PDF
# extra option needed to satisfy "levels nested too deeply" error
# expect it to fail (thus exit 0) since nexus.ind not found first time
( pdflatex --interaction=nonstopmode nexus.tex || exit 0 )
# make the .ind file now
makeindex nexus.idx
# run again with fresh nexus.ind
( pdflatex --interaction=nonstopmode nexus.tex || exit 0 )
cd ..
#pdf
cp -f latex/nexus.pdf ${DIST_ROOT}/pdf/NeXusManual.pdf
wget https://github.com/nexusformat/code/raw/master/doc/api/NeXusIntern.pdf -O ${DIST_ROOT}/pdf/NeXusIntern.pdf
wget https://github.com/nexusformat/code/raw/master/applications/NXtranslate/docs/NXtranslate.pdf -O ${DIST_ROOT}/pdf/NXtranslate.pdf
#html
cp -fr html/* ${DIST_ROOT}
cd ../../..
cp -fr /isis/www/nexus/doxygen ${DIST_ROOT}
( cd impatient-guide && cp -f _build/latex/NXImpatient.pdf ${DIST_ROOT}/pdf/NXImpatient.pdf && cp -rf _build/html ${DIST_ROOT}/impatient )
cd ${DIST_ROOT}
git add .
git commit -m "Update docs for ${git_rev}"
git push origin gh-pages
fi
exit 0