Created
March 28, 2020 19:14
-
-
Save markaltmann/094741dc2566875a572326d9cf436432 to your computer and use it in GitHub Desktop.
Jenkinsfile for Asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
// Good example for asciidoc-pdf maven: | |
// https://github.com/asciidoctor/asciidoctor-maven-examples/blob/master/asciidoctor-pdf-example/pom.xml | |
pipeline { | |
options { | |
buildDiscarder logRotator( | |
daysToKeepStr: '10', | |
numToKeepStr: env.BRANCH_NAME == 'master' ? '20' : '30' , | |
artifactDaysToKeepStr: '10', | |
artifactNumToKeepStr: '10' | |
) | |
timestamps() | |
timeout(time: 1, unit: 'HOURS') | |
ansiColor("xterm") | |
disableConcurrentBuilds() | |
} | |
agent any() | |
stages { | |
stage ('Build - AsciiDoc Document') { | |
steps { | |
script { | |
docker.image('maven:3.6-jdk-12').inside('-v /root/.m2:/root/.m2') { | |
sh('mvn -B generate-resources') // AsciiDoc Target PDF | |
} | |
} | |
archiveArtifacts 'pdf/asciidoc.pdf' // Put the artefact to the build artefacts. | |
} | |
} | |
} | |
post { | |
always { | |
echo 'One way or another, I have finished' | |
} | |
success { | |
echo 'I succeeeded!' | |
} | |
unstable { | |
echo 'I am unstable :/' | |
} | |
failure { | |
echo 'Failure: Check Error Log' | |
} | |
cleanup { | |
cleanWs() // Delete the whole Workspace | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment