forked from ubports/docs.ubports.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
45 lines (45 loc) · 1.26 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
pipeline {
agent {
docker {
image "python:3.7"
}
}
options {
buildDiscarder(logRotator(daysToKeepStr: '120'))
}
environment {
HOME = "${env.WORKSPACE}"
}
stages {
stage("Install dependencies") {
steps {
sh 'pip install --no-cache-dir --user --upgrade -r requirements.txt'
}
}
stage("Build docs"){
steps {
sh 'python3 -m sphinx -Wab html . _build/html/'
sh 'cp redir.html _build/html/..index.html'
archiveArtifacts artifacts: '_build/html/', onlyIfSuccessful: true
}
}
stage('Fix git ref for non-master builds') {
when { not { branch 'master' } }
steps {
// Workaround to create the master branch since Jenkins
// refuses to do it on PR builds
sh 'git show-ref --verify --quiet master || git branch master `git show-ref -s origin/master`'
}
}
stage('Check redirects') {
steps {
sh 'python3 -m sphinx -Wab rediraffecheckdiff . _build/html'
}
}
}
post {
cleanup {
cleanWs()
}
}
}