remove braces
[maven-build-process.git] / build / jenkins / Release
blob1f2a817f48b63142dce70d54013d042587662557
1 node {
2     stage('Checkout') {
3         checkout scm
4     }
6     stage('Versioning') {
7         withMaven(
8             maven: 'maven-latest',
9             mavenSettingsConfig: 'repository.metio.wtf',
10             mavenLocalRepo: '.repository') {
11             try {
12                 def timestamp = new java.text.SimpleDateFormat('yyyy.MM.dd-HHmmss').format(new Date())
13                 sh "mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${timestamp}"
14             } catch (exception) {
15                 currentBuild.result = 'FAILURE'
16                 throw exception
17             }
18         }
19     }
21     stage('Build & Deploy') {
22         withCredentials([
23                 string(credentialsId: 'pgp.secretkey', variable: 'pgp_key'),
24                 string(credentialsId: 'pgp.passphrase', variable: 'pgp_passphrase')]) {
25             withMaven(
26                 maven: 'maven-latest',
27                 mavenSettingsConfig: 'repository.metio.wtf',
28                 mavenLocalRepo: '.repository') {
29                 try {
30                     sh "mvn clean pgp:sign deploy scm:tag -Drelease=sonatype -DpushChanges=false -Dpgp.secretKey=$pgp_key -Dpgp.passphrase=$pgp_passphrase"
31                 } catch (exception) {
32                     currentBuild.result = 'FAILURE'
33                 }
34             }
35         }
36     }
38     stage('Cleanup') {
39         dir('.repository') {
40             deleteDir()
41         }
42     }