forked from ozangunalp/gitflow-incremental-builder
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Jenkinsfile
30 lines (28 loc) · 1.05 KB
/
Jenkinsfile
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
#!groovy
def deployBranches = [ "master", "develop" ]
def phase = "verify"
stage ('Build') {
node {
checkout scm
def branch = scm.branches[0].name
if (deployBranches.contains(branch)) {
phase = "deploy"
}
echo "Running mvn $phase on branch $branch"
sh 'mkdir -p ~/.gnupg'
withCredentials([
file(credentialsId: 'gpg-pubring', variable: 'GPG_PUB_RING'),
file(credentialsId: 'gpg-secring', variable: 'GPG_SEC_RING'),
file(credentialsId: 'gpg-settings', variable: 'MVN_SETTINGS')]) {
try {
sh "mvn clean $phase -P release --settings=$MVN_SETTINGS -Dgpg.publicKeyring=$GPG_PUB_RING -Dgpg.secretKeyring=$GPG_SEC_RING"
} finally {
archiveArtifacts 'target/*.jar'
archiveArtifacts 'target/*.asc'
archiveArtifacts 'target/*.pom'
junit 'target/surefire-reports/*.xml'
}
}
step([$class: 'WsCleanup'])
}
}