-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
81 lines (80 loc) · 3.29 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
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
pipeline {
agent {
kubernetes {
cloud 'kubernetes-azure'
defaultContainer 'jnlp'
inheritFrom 'plain'
yamlFile './build/agent.yml'
}
}
stages {
stage('Build library') {
when {
anyOf {
changeRequest()
branch 'develop'
branch 'main'
tag comparator: 'REGEXP', pattern: '^v\\d+\\.\\d+\\.\\d+$'
}
}
steps {
container('gradle') {
dir('library') {
sh 'gradle build'
}
}
}
}
stage('Publish snapshot') {
when {
anyOf {
branch 'develop'
}
}
steps {
container('gradle') {
dir('library') {
withCredentials([
file(credentialsId: 'fluxflow-keyring', variable: 'KEYRING_FILE'),
string(credentialsId: 'fluxflow-keyring-password', variable: 'KEYRING_PASSWORD'),
usernamePassword(credentialsId: 'fluxflow-snapshot-publisher', usernameVariable: 'MAVEN_USER', passwordVariable: 'MAVEN_PASSWORD')
]) {
sh "gradle publishMavenPublicationToSnapshotRepository" +
" -PsnapshotUsername=\"\$MAVEN_USER\"" +
" -PsnapshotPassword=\"\$MAVEN_PASSWORD\"" +
" -Psigning.keyId=73F5D362" +
" -Psigning.password=\"\$KEYRING_PASSWORD\"" +
" -Psigning.secretKeyRingFile=\"\$KEYRING_FILE\""
}
}
}
}
}
stage('Publish Maven Central Staging') {
when {
anyOf {
tag comparator: 'REGEXP', pattern: '^v\\d+\\.\\d+\\.\\d+$'
}
}
steps {
container('gradle') {
dir('library') {
withCredentials([
file(credentialsId: 'fluxflow-keyring', variable: 'KEYRING_FILE'),
string(credentialsId: 'fluxflow-keyring-password', variable: 'KEYRING_PASSWORD'),
usernamePassword(credentialsId: 'fluxflow-maven-central-publish-user', passwordVariable: 'MAVEN_PASSWORD', usernameVariable: 'MAVEN_USER')
]) {
sh "gradle publishMavenPublicationToStagingRepository" +
" -PprojVersion=\"$TAG_NAME\"" +
" -PstagingUsername=\"\$MAVEN_USER\"" +
" -PstagingPassword=\"\$MAVEN_PASSWORD\"" +
" -Psigning.keyId=73F5D362" +
" -Psigning.password=\"\$KEYRING_PASSWORD\"" +
" -Psigning.secretKeyRingFile=\"\$KEYRING_FILE\""
}
}
}
}
}
}
}