forked from bonitasoft/bonita-doc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
67 lines (56 loc) · 1.81 KB
/
Jenkinsfile
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
#!/usr/bin/env groovy
boolean isVersionSupported(version, supportedVersions) {
def result = false
for (supported in supportedVersions.tokenize(',')) {
if (supported == version) {
result = true
break
}
}
def status = result ? 'supported' : 'NOT supported'
println "Version <$version> is $status on this environment."
return result
}
node {
stage 'Checkout'
def branch_name = env.BRANCH_NAME
println "Checking out branch $branch_name"
checkout scm
stage 'Build'
def nodejsHome = tool name: 'NodeJS_424', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool'
sh """#!/bin/bash
set -e
env | sort -u
echo "### Cleaning previous build (except index.html)"
shopt -s extglob
rm -rf build
echo ""
echo "### Converting .md to .html"
PATH=\$PATH:${nodejsHome}/bin
npm install
scripts/convertMdToHtml.js 7.3
scripts/taxonomy.js
echo ""
echo "### Creating doc html archive"
archive_name=doc-html-\$BRANCH_NAME-`date +"%Y%m%d_%H%M%S"`.tar.gz
rm -rf doc-html*.tar.gz doc-html
mkdir doc-html && ln -s ../build/html doc-html/html && ln -s ../md/images doc-html/images
tar czf \$archive_name --dereference doc-html
echo ". Generated archive: \$archive_name"
echo ""
echo "Done."
"""
stage 'Archive'
archive '**/doc-html*.tar.gz'
stage 'Deploy'
parallel preprod: {
if (isVersionSupported(branch_name, env.GLOBAL_PREPROD_VERSIONS)) {
build job: 'push-content-preprod', parameters: [[$class: 'StringParameterValue', name: 'ARE_YOU_SURE', value: 'Yes']]
}
}, prod: {
if (isVersionSupported(branch_name, env.GLOBAL_PROD_VERSIONS)) {
build job: 'push-content-prod', parameters: [[$class: 'StringParameterValue', name: 'ARE_YOU_SURE', value: 'Yes']]
}
},
failFast: false
}