Skip to content

Commit ca1677e

Browse files
authoredJun 18, 2019
initial Jenkinsfile build gitbook and upload output to github.com/mavlink/sdk.mavlink.io
1 parent d986081 commit ca1677e

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed
 

‎.nojekyll

Whitespace-only changes.

‎Jenkinsfile

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
pipeline {
2+
agent {
3+
docker {
4+
image 'px4io/px4-docs:2019-02-03'
5+
}
6+
}
7+
stages {
8+
9+
stage('Build') {
10+
environment {
11+
HOME = "${WORKSPACE}"
12+
}
13+
14+
steps {
15+
sh('export')
16+
checkout(scm)
17+
sh('gitbook install')
18+
sh('gitbook build')
19+
stash(includes: '_book/', name: 'gitbook')
20+
// publish html
21+
publishHTML(target: [
22+
reportTitles: 'Mavlink SDK Guide',
23+
allowMissing: false,
24+
alwaysLinkToLastBuild: true,
25+
keepAll: true,
26+
reportDir: '_book',
27+
reportFiles: '*',
28+
reportName: 'Mavlink SDK Guide'
29+
])
30+
}
31+
32+
} // Build
33+
34+
stage('Deploy') {
35+
environment {
36+
GIT_AUTHOR_EMAIL = "bot@px4.io"
37+
GIT_AUTHOR_NAME = "PX4BuildBot"
38+
GIT_COMMITTER_EMAIL = "bot@px4.io"
39+
GIT_COMMITTER_NAME = "PX4BuildBot"
40+
}
41+
42+
steps {
43+
sh('export')
44+
unstash('gitbook')
45+
withCredentials([usernamePassword(credentialsId: 'px4buildbot_github_personal_token', passwordVariable: 'GIT_PASS', usernameVariable: 'GIT_USER')]) {
46+
sh('git clone https://${GIT_USER}:${GIT_PASS}@github.com/mavlink/sdk.mavlink.io')
47+
sh('rm -rf sdk.mavlink.io/${BRANCH_NAME}')
48+
sh('mkdir -p sdk.mavlink.io/${BRANCH_NAME}')
49+
sh('cp -r _book/* sdk.mavlink.io/${BRANCH_NAME}/')
50+
sh('cd sdk.mavlink.io; git add ${BRANCH_NAME}; git commit -a -m "gitbook build update `date`"')
51+
sh('cd sdk.mavlink.io; git push origin master')
52+
53+
}
54+
}
55+
post {
56+
always {
57+
sh('rm -rf sdk.mavlink.io')
58+
}
59+
}
60+
when {
61+
anyOf {
62+
branch "master"
63+
branch "pr-jenkins"
64+
branch "v1.*"
65+
branch "v0.*"
66+
}
67+
}
68+
69+
} // Deploy
70+
} // stages
71+
72+
options {
73+
buildDiscarder(logRotator(numToKeepStr: '10', artifactDaysToKeepStr: '30'))
74+
skipDefaultCheckout()
75+
timeout(time: 60, unit: 'MINUTES')
76+
}
77+
78+
}

0 commit comments

Comments
 (0)
Please sign in to comment.