-
Notifications
You must be signed in to change notification settings - Fork 2
/
.dukescript
40 lines (36 loc) · 1.33 KB
/
.dukescript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!groovy
node ('Mac') {
stage('Build') {
checkout scm
jdk = tool name: 'JDK8u221'
env.JAVA_HOME = "${jdk}"
if (env.GPG_DIR) {
env.PATH="${env.PATH}:${env.GPG_DIR}"
}
pom = readFile 'pom.xml'
if (pom.contains('-SNAPSHOT</version>')) {
mvnargs=''
} else {
mvnargs='-DskipTests'
}
withMaven(
maven : 'M3',
mavenSettingsConfig : '1745afa9-9479-4838-b15d-14029f4cfc8d'
) {
withCredentials([file(credentialsId: 'PRIVATE_KEY', variable: 'KEY')]) {
sh "gpg --batch --import ${env.KEY}"
sh "gpgconf --kill gpg-agent"
sh "gpg-agent --daemon --allow-preset-passphrase --batch"
if (env.GPG_PASSPHRASE) {
withCredentials([usernamePassword(credentialsId: 'd0aa9e41-82e0-4562-bb67-b42364e8aa35',
passwordVariable: 'GPG_PASSWD', usernameVariable: 'GPG_ID')
]) {
sh "${env.GPG_PASSPHRASE} --preset --passphrase ${GPG_PASSWD} ${GPG_ID}"
}
}
sh "mvn ${mvnargs} clean install -Prelease -Dgpg.useagent=true"
sh "mvn -DskipTests deploy -Prelease -Dgpg.useagent=true"
}
}
}
}