-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.groovy
55 lines (50 loc) · 1.86 KB
/
Jenkinsfile.groovy
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
pipeline {
agent {
label 'WebApp_Linux'
}
options {
parallelsAlwaysFailFast()
disableConcurrentBuilds()
}
parameters {
string(name: 'version', defaultValue: '0.0.1')
booleanParam(name: 'deploy', defaultValue: false)
}
stages {
stage('Checkout') {
steps {
git branch: 'main', url: 'https://github.com/wireapp/picklejar-engine.git'
}
}
stage('Build') {
steps {
withMaven(jdk: 'AdoptiumJDK17', maven: 'M3', options: [junitPublisher(disabled: true)]) {
realtimeJUnit(keepLongStdio: true, testResults: 'build/test-results/test/TEST*.xml') {
sh './gradlew clean build'
}
}
stash includes: 'build/libs/*.jar', name: 'artifacts'
archiveArtifacts artifacts: 'build/libs/*.jar', followSymlinks: false
}
}
stage('Deploy') {
when {
expression { return params.deploy }
}
steps {
withCredentials([ usernamePassword( credentialsId: 'sonatype-nexus', usernameVariable: 'SONATYPE_USERNAME', passwordVariable: 'SONATYPE_PASSWORD' ),
file(credentialsId: 'DC640D79AF40EEFF.asc', variable: 'PGP_PRIVATE_KEY_FILE'),
string(credentialsId: 'PGP_PASSPHRASE', variable: 'PGP_PASSPHRASE') ]) {
withMaven(maven: 'M3') {
unstash 'artifacts'
sh(
script: """
version=$version deploy=$deploy ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
"""
)
}
}
}
}
}
}