-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
115 lines (101 loc) · 3.83 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
pipeline {
agent any
tools {
jdk "Temurin Java 17"
}
triggers {
githubPush()
}
stages {
stage('Checkout') {
steps {
scmSkip(deleteBuild: true)
}
}
stage('Setup Gradle') {
steps {
sh 'chmod +x gradlew'
}
}
stage('Build') {
steps {
withGradle {
sh './gradlew build --rerun-tasks -x check'
}
}
post {
success {
archiveArtifacts artifacts: '**/build/libs/*.jar', fingerprint: true, onlyIfSuccessful: true
javadoc javadocDir: 'build/dokka/html/', keepAll: true
}
}
}
stage('Deploy to snapshots repositories') {
when {
allOf {
not { buildingTag() }
not { expression { env.TAG_NAME != null && env.TAG_NAME.matches('v\\d+\\.\\d+\\.\\d+') } }
}
}
steps {
withCredentials([
string(credentialsId: 'maven-signing-key', variable: 'ORG_GRADLE_PROJECT_signingKey'),
string(credentialsId: 'maven-signing-key-password', variable: 'ORG_GRADLE_PROJECT_signingPassword'),
usernamePassword(
credentialsId: 'solo-studios-maven',
passwordVariable: 'ORG_GRADLE_PROJECT_SoloStudiosSnapshotsPassword',
usernameVariable: 'ORG_GRADLE_PROJECT_SoloStudiosSnapshotsUsername'
)
]) {
withGradle {
sh './gradlew publishAllPublicationsToSoloStudiosSnapshotsRepository'
}
}
}
}
stage('Deploy to releases repositories') {
when {
allOf {
buildingTag()
expression { env.TAG_NAME != null && env.TAG_NAME.matches('v\\d+\\.\\d+\\.\\d+') }
}
}
steps {
withCredentials([
string(credentialsId: 'maven-signing-key', variable: 'ORG_GRADLE_PROJECT_signingKey'),
string(credentialsId: 'maven-signing-key-password', variable: 'ORG_GRADLE_PROJECT_signingPassword'),
usernamePassword(
credentialsId: 'solo-studios-maven',
passwordVariable: 'ORG_GRADLE_PROJECT_SoloStudiosReleasesPassword',
usernameVariable: 'ORG_GRADLE_PROJECT_SoloStudiosReleasesUsername'
),
usernamePassword(
credentialsId: 'sonatype-maven-credentials',
passwordVariable: 'ORG_GRADLE_PROJECT_SonatypePassword',
usernameVariable: 'ORG_GRADLE_PROJECT_SonatypeUsername'
)
]) {
withGradle {
sh './gradlew publishAllPublicationsToSoloStudiosReleasesRepository'
sh './gradlew publishAllPublicationsToSonatypeRepository'
}
}
}
}
}
post {
always {
discoverReferenceBuild()
recordIssues(
aggregatingResults: true,
enabledForFailure: true,
minimumSeverity: 'ERROR',
sourceCodeEncoding: 'UTF-8',
checksAnnotationScope: 'ALL',
sourceCodeRetention: 'LAST_BUILD',
tools: [kotlin()]
)
cleanWs()
}
}
}