re-add pgp credentials
[maven-build-process.git] / build / jenkins / UpdateProperties
blobf07e994f29f0ec93f596efb5c4066e81a1d8e634
1 node {
3     def projectName = "sebhoss/maven-build-process"
4     def repositoryLocation = ".repository"
5     def mavenVersion = "maven-latest"
6     def mavenSettings = "repository.metio.wtf"
7     def githubCredentials = "build-metio-wtf-github"
9     stage('Cleanup') {
10         dir("${repositoryLocation}") {
11             deleteDir()
12         }
13     }
15     stage('Checkout') {
16         checkout scm
17     }
19     stage('Update Properties') {
20         withMaven(
21                 maven: "${mavenVersion}",
22                 mavenSettingsConfig: "${mavenSettings}",
23                 mavenLocalRepo: "${repositoryLocation}") {
24             sh """
25                 mvn --batch-mode \
26                     --show-version \
27                     --update-snapshots \
28                     versions:update-properties \
29                     -DgenerateBackupPoms=false
30             """
31         }
32     }
34     stage('Git config') {
35         withCredentials([
36                 string(credentialsId: 'git.user.name', variable: 'GIT_USER'),
37                 string(credentialsId: 'git.user.email', variable: 'GIT_EMAIL')]) {
38             sh "git config user.name '${GIT_USER}'"
39             sh "git config user.email '${GIT_EMAIL}'"
40         }
41     }
43     stage('Git Commit') {
44         sh "git add pom.xml **/**/pom.xml"
45         sh "git commit -s -m 'Update properties to latest version'"
46     }
48     stage('Git Push') {
49          withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: "${githubCredentials}",
50                             usernameVariable: 'USERNAME', passwordVariable: 'TOKEN']]) {
51             sh "git push https://${TOKEN}:x-oauth-basic@github.com/${projectName}.git"
52         }
53     }