Skip to content

Instantly share code, notes, and snippets.

@s-petit
s-petit / Jenkinsfile-release
Last active July 10, 2018 12:47
Perform a maven release via a Jenkins pipeline with declarative syntax
#!/usr/bin/env groovy
pipeline {
stages {
stage('Prepare') {
steps {
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'YOUR_CREDENTIALS_ID', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD']]) {
sh 'mvn -B release:prepare -Dusername=$GIT_USERNAME -Dpassword=$GIT_PASSWORD'
}
}