CSIT-474: CSIT documentation publishing
[ci-management.git] / jjb / csit / include-raw-csit-docs.sh
1 #!/bin/bash
2
3 set -xe -o pipefail
4
5 [ "$DOCS_REPO_URL" ] || DOCS_REPO_URL="https://nexus.fd.io/content/sites/site"
6 [ "$PROJECT_PATH" ] || PROJECT_PATH=io/fd/csit
7 [ "$DOC_DIR" ] || DOC_DIR=resources/tools/doc_gen
8 [ "$BUILD_DIR" ] || BUILD_DIR=_build
9 [ "$MVN" ] || MVN="/opt/apache/maven/bin/mvn"
10
11 cd ${DOC_DIR}
12
13 chmod +x ./run_doc.sh
14 ./run_doc.sh
15
16 retval=$?
17 if [ ${retval} -ne "0" ]; then
18   echo "Documentation generation failed!"
19 exit ${retval}
20 fi
21
22 if [[ ${JOB_NAME} == *merge* ]]; then
23
24   cd ${BUILD_DIR}
25
26   cat > pom.xml << EOF
27   <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
28     <modelVersion>4.0.0</modelVersion>
29     <groupId>io.fd.csit</groupId>
30     <artifactId>docs</artifactId>
31     <version>1.0.0</version>
32     <packaging>pom</packaging>
33     <properties>
34       <generateReports>false</generateReports>
35     </properties>
36     <build>
37       <extensions>
38         <extension>
39           <groupId>org.apache.maven.wagon</groupId>
40           <artifactId>wagon-webdav-jackrabbit</artifactId>
41           <version>2.9</version>
42         </extension>
43       </extensions>
44     </build>
45     <distributionManagement>
46       <site>
47         <id>fdio-site</id>
48         <url>dav:${DOCS_REPO_URL}/${PROJECT_PATH}/${STREAM}</url>
49       </site>
50     </distributionManagement>
51   </project>
52 EOF
53
54   ${MVN} site:site site:deploy -gs "${GLOBAL_SETTINGS_FILE}" -s "${SETTINGS_FILE}" -T 4C
55
56   cd -
57
58 fi