加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Jenkinsfile 1.86 KB
一键复制 编辑 原始数据 按行查看 历史
pipeline {
agent {
docker {
image 'px4io/px4-docs:2020-01-05'
}
}
stages {
stage('Build') {
environment {
HOME = "${WORKSPACE}"
}
steps {
sh('export')
checkout(scm)
sh('gitbook install')
sh('gitbook build')
stash(includes: '_book/', name: 'gitbook')
// publish html
publishHTML(target: [
reportTitles: 'PX4 Dev Guide',
allowMissing: false,
alwaysLinkToLastBuild: true,
keepAll: true,
reportDir: '_book',
reportFiles: '*',
reportName: 'PX4 Dev Guide'
])
}
} // Build
stage('Deploy') {
environment {
GIT_AUTHOR_EMAIL = "bot@px4.io"
GIT_AUTHOR_NAME = "PX4BuildBot"
GIT_COMMITTER_EMAIL = "bot@px4.io"
GIT_COMMITTER_NAME = "PX4BuildBot"
}
steps {
sh('export')
unstash('gitbook')
withCredentials([usernamePassword(credentialsId: 'px4buildbot_github_personal_token', passwordVariable: 'GIT_PASS', usernameVariable: 'GIT_USER')]) {
sh('git clone https://${GIT_USER}:${GIT_PASS}@github.com/PX4/dev.px4.io.git')
sh('rm -rf dev.px4.io/${BRANCH_NAME}')
sh('mkdir -p dev.px4.io/${BRANCH_NAME}')
sh('cp -r _book/* dev.px4.io/${BRANCH_NAME}/')
sh('cd dev.px4.io; git add ${BRANCH_NAME}; git commit -a -m "gitbook build update `date`"')
sh('cd dev.px4.io; git push origin master')
}
}
post {
always {
sh('rm -rf dev.px4.io')
}
}
when {
anyOf {
branch "master";
branch "v1.*"
}
}
} // Deploy
} // stages
options {
buildDiscarder(logRotator(numToKeepStr: '10', artifactDaysToKeepStr: '30'))
skipDefaultCheckout()
timeout(time: 60, unit: 'MINUTES')
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化