-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathjenkins_build
executable file
·113 lines (82 loc) · 2.88 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#!/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
export WWW_ROOT=/isis/www/nexus
mkdir -p ${WWW_ROOT}/doc/examples
# delete after first run
rm -fr ${WWW_ROOT}/doc/nxvalidate
cd manual
cd source
rm -fr ${WWW_ROOT}/doc/examples
cp -fr examples ${WWW_ROOT}/doc
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 ${WWW_ROOT}/doc/NeXusManual.pdf
#html
rm -fr ${WWW_ROOT}/doc/html
cp -fr html ${WWW_ROOT}/doc
cd ../../..
( cd www/download.nexusformat.org; cp -rf * ${WWW_ROOT} )
( cd impatient-guide && cp -f _build/latex/NXImpatient.pdf ${WWW_ROOT}/doc/NXImpatient.pdf && rm -rf ${WWW_ROOT}/doc/impatient && cp -rf _build/html ${WWW_ROOT}/doc/impatient )
fi
## 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}
rm -fr ${DIST_ROOT}/*
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/blob/master/doc/api/NeXusIntern.pdf -O ${DIST_ROOT}/pdf/NeXusIntern.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
exit 0