/
Jenkinsfile
73 lines (62 loc) · 2.12 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
68
69
70
71
72
73
#!/usr/bin/env groovy
properties([
buildDiscarder(logRotator(numToKeepStr: '2')),
pipelineTriggers([cron('H 5 * * 1')]),
])
node('linux') {
checkout scm
dir("scripts/build") {
deleteDir()
}
dir("build") {
deleteDir()
}
stage('Generate Javadocs') {
withEnv([
"PATH+MVN=${tool 'mvn'}/bin",
"JAVA_HOME=${tool 'jdk11'}",
"PATH+GROOVY=${tool 'groovy'}/bin",
"PATH+JAVA=${tool 'jdk11'}/bin",
]) {
sh './scripts/generate-javadoc.sh'
}
}
stage('Generate Shortnames') {
sh './scripts/generate-shortnames.sh'
}
stage('Prepare Latest') {
sh './scripts/default-to-latest.sh'
}
stage('Archive') {
sh 'cd build && tar -cjf javadoc-site.tar.bz2 site'
archiveArtifacts artifacts: 'build/*.tar.bz2',
allowEmptyArchive: false,
fingerprint: false,
onlyIfSuccessful: true
}
if (infra.isTrusted()){
stage('Publish on Azure') {
/* -> https://github.com/Azure/blobxfer
Require credential 'JAVADOC_STORAGEACCOUNTKEY' set to the storage account key */
withCredentials([string(credentialsId: 'JAVADOC_STORAGEACCOUNTKEY', variable: 'JAVADOC_STORAGEACCOUNTKEY')]) {
sh './scripts/blobxfer upload \
--local-path /data/site \
--storage-account-key $JAVADOC_STORAGEACCOUNTKEY \
--storage-account prodjavadoc \
--remote-path javadoc \
--recursive \
--mode file \
--skip-on-md5-match \
--file-md5 \
--connect-timeout 30 \
--delete'
}
}
}
stage('Clean up') {
echo 'We want to generate fresh javadocs on each run'
dir('build/site') {
deleteDir()
}
}
}