This repository has been archived by the owner on May 3, 2024. It is now read-only.
forked from FAIRmat-NFDI/nexus_definitions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jenkins_build
executable file
·91 lines (68 loc) · 2.46 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
#!/bin/sh
set -o errexit -x
# jenkins job name
job_name="$1"
#export PATH=/usr/local/bin:$PATH
## install local python virtual environment
## based on local requirements.txt
PYDIR=$(pwd)/python
rm -fr "${PYDIR}"
python -m venv ${PYDIR}
source $PYDIR/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
if test -d build; then
rm -fr build
fi
make builddir
cd build
make
mkdir -p web_nxdl/3.1
rm -f web_nxdl/3.1/*
cp -f ../nxdl.xsd web_nxdl
cp base_classes/*.xsl base_classes/*.xml applications/*.xml contributed_definitions/*.xml web_nxdl/3.1
( cd ../impatient-guide && rm -rf _build && make latexpdf && make html )
# publish
if test "${job_name}" = "main 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
( cd impatient-guide && cp -f _build/latex/NXImpatient.pdf ${DIST_ROOT}/_static/NXImpatient.pdf && cp -rf _build/html ${DIST_ROOT}/impatient )
cp -f latex/nexus.pdf ${DIST_ROOT}/_static/NeXusManual.pdf
wget https://github.com/nexusformat/code/raw/master/doc/api/NeXusIntern.pdf -O ${DIST_ROOT}/_static/NeXusIntern.pdf
wget https://github.com/nexusformat/code/raw/master/applications/NXtranslate/docs/NXtranslate.pdf -O ${DIST_ROOT}/_static/NXtranslate.pdf
#html
cp -fr html/* ${DIST_ROOT}
cd ../../..
cp -fr /isis/www/nexus/doxygen ${DIST_ROOT}
cd ${DIST_ROOT}
git add .
git commit -m "Update docs for ${git_rev}"
git push origin gh-pages
fi
exit 0