-
Notifications
You must be signed in to change notification settings - Fork 18
/
build-release.jenkins
40 lines (31 loc) · 1.27 KB
/
build-release.jenkins
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
// must be executed on a docker-enabled node
node('docker-based-builds') {
// check out branch that triggered the build
stage('Checkout SCM') {
checkout scm
}
// load build environment docker container
def container = docker.image('caaqe/basic-build-environment:latest')
container.pull()
container.inside {
stage('Log Tool Versions') {
sh 'java -version'
sh 'git --version'
sh 'mvn --version'
sh 'gpg --version'
}
stage('Build & Deploy to Sonatype OSS') {
// credentials for the repository are stored in Jenkins
withCredentials([usernamePassword(credentialsId: 'ossrh-credentials', passwordVariable: 'ossrhPassword', usernameVariable: 'ossrhUsername')]) {
// credentials for the GPG certificates are stored in Jenkins
withCredentials([string(credentialsId: 'aqe-gpg-passphrase', variable: 'gpgPassphrase')]) {
def skipTests = "-DskipTests=true"
def gpgPassphrase = "-Dgpg.passphrase=${gpgPassphrase}"
def repositoryCredentials = "-Dossrh.username=${ossrhUsername} -Dossrh.password=${ossrhPassword}"
def profiles = "-P maven-central"
sh "./mvnw clean deploy ${skipTests} ${gpgPassphrase} ${repositoryCredentials} ${profiles}"
}
}
}
}
}