Last active
August 3, 2020 15:19
-
-
Save mkutz/656f58abbe61b566a54dff5fe8f142e7 to your computer and use it in GitHub Desktop.
Jenkinsfile using two successive stage with when to eaxecute either the one or the other stage
This file contains hidden or 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 | |
parameters { | |
booleanParam(name: "RELEASE", defaultValue: false) | |
} | |
stages { | |
stage("Build") { | |
steps { | |
sh "./gradlew build" | |
} | |
} | |
stage("Publish Pre-Release") { | |
when { expression { !params.RELEASE } } | |
steps { | |
sh "./gradlew preRelease" | |
} | |
} | |
stage("Publish Release") { | |
when { expression { params.RELEASE } } | |
steps { | |
sh "./gradlew release" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment