3 def projectName = "sebhoss/maven-build-process"
4 def repositoryLocation = ".repository"
5 def timestamp = new java.text.SimpleDateFormat('yyyy.MM.dd-HHmmss').format(new Date())
6 def mavenVersion = "maven-latest"
7 def mavenSettings = "repository.metio.wtf"
8 def releaseTarget = "sonatype"
9 def skipLocalStaging = "false"
10 def githubCredentials = "build-metio-wtf-github"
22 maven: "${mavenVersion}",
23 globalMavenSettingsConfig: "${mavenSettings}",
24 mavenLocalRepo: "${repositoryLocation}") {
29 -DgenerateBackupPoms=false \
30 -DnewVersion=${timestamp}
36 withSonarQubeEnv('quality.metio.wtf') {
38 maven: "${mavenVersion}",
39 globalMavenSettingsConfig: "${mavenSettings}",
40 mavenLocalRepo: "${repositoryLocation}") {
52 string(credentialsId: 'pgp.secretkey', variable: 'PGP_KEY'),
53 string(credentialsId: 'pgp.passphrase', variable: 'PGP_PASSPHRASE')]) {
54 configFileProvider([configFile(fileId: "${mavenSettings}", variable: 'MAVEN_SETTINGS')]) {
56 maven: "${mavenVersion}",
57 mavenLocalRepo: "${repositoryLocation}") {
60 --settings $MAVEN_SETTINGS \
62 org.kohsuke:pgp-maven-plugin:sign deploy \
63 -Drelease=${releaseTarget} \
64 -DskipLocalStaging=${skipLocalStaging} \
65 -Dpgp.secretKey=keyfile:${PGP_KEY} \
66 -Dpgp.passphrase=literal:'${PGP_PASSPHRASE}'
75 string(credentialsId: 'git.user.name', variable: 'GIT_USER'),
76 string(credentialsId: 'git.user.email', variable: 'GIT_EMAIL')]) {
77 sh "git config user.name '${GIT_USER}'"
78 sh "git config user.email '${GIT_EMAIL}'"
84 maven: "${mavenVersion}",
85 mavenSettingsConfig: "${mavenSettings}",
86 mavenLocalRepo: "${repositoryLocation}") {
97 withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: "${githubCredentials}",
98 usernameVariable: 'USERNAME', passwordVariable: 'TOKEN']]) {
99 sh "git push https://${TOKEN}:x-oauth-basic@github.com/${projectName}.git --tags"