Last active
March 22, 2019 08:02
-
-
Save mkutz/bbe944aca42f7b73fffc1d5fd3f6c813 to your computer and use it in GitHub Desktop.
This Jenkinsfile describes a pipeline to build and (optinally) release a Maven library.
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 | |
// see https://jenkins.io/doc/book/pipeline/syntax/ | |
pipeline { | |
agent any | |
tools { | |
maven "Maven" | |
} | |
triggers { | |
pollSCM "* * * * *" | |
} | |
options { | |
timestamps() | |
ansiColor("xterm") | |
} | |
parameters { | |
booleanParam(name: "RELEASE", | |
description: "Build a release from current commit.", | |
defaultValue: false) | |
} | |
stages { | |
stage("Build & Deploy SNAPSHOT") { | |
steps { | |
sh "mvn -B deploy" | |
} | |
} | |
stage("Release") { | |
when { | |
expression { params.RELEASE } | |
} | |
steps { | |
sh "mvn -B release:prepare" | |
sh "mvn -B release:perform" | |
} | |
} | |
} | |
post { | |
always { | |
deleteDir() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment