Skip to content

Commit 06db25b

Browse files
committed
[#1956] Add Jenkins publish snapshots pipeline configuration
1 parent 9c41175 commit 06db25b

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

ci/snapshot-publish.Jenkinsfile

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* See https://github.com/hibernate/hibernate-jenkins-pipeline-helpers
3+
*/
4+
@Library('[email protected]') _
5+
6+
// Avoid running the pipeline on branch indexing
7+
if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) {
8+
print "INFO: Build skipped due to trigger being Branch Indexing"
9+
currentBuild.result = 'NOT_BUILT'
10+
return
11+
}
12+
13+
pipeline {
14+
agent {
15+
label 'Fedora'
16+
}
17+
tools {
18+
jdk 'OpenJDK 11 Latest'
19+
}
20+
options {
21+
rateLimitBuilds(throttle: [count: 1, durationName: 'hour', userBoost: true])
22+
buildDiscarder(logRotator(numToKeepStr: '3', artifactNumToKeepStr: '3'))
23+
disableConcurrentBuilds(abortPrevious: true)
24+
}
25+
stages {
26+
stage('Checkout') {
27+
steps {
28+
checkout scm
29+
}
30+
}
31+
stage('Publish') {
32+
steps {
33+
withCredentials([
34+
usernamePassword(credentialsId: 'ossrh.sonatype.org', usernameVariable: 'hibernatePublishUsername', passwordVariable: 'hibernatePublishPassword'),
35+
usernamePassword(credentialsId: 'plugins.gradle.org', usernameVariable: 'hibernatePluginPortalUsername', passwordVariable: 'hibernatePluginPortalPassword'),
36+
string(credentialsId: 'release.gpg.passphrase', variable: 'SIGNING_PASS'),
37+
file(credentialsId: 'release.gpg.private-key', variable: 'SIGNING_KEYRING')
38+
]) {
39+
sh '''./gradlew clean publish \
40+
-PhibernatePublishUsername=$hibernatePublishUsername \
41+
-PhibernatePublishPassword=$hibernatePublishPassword \
42+
-Pgradle.publish.key=$hibernatePluginPortalUsername \
43+
-Pgradle.publish.secret=$hibernatePluginPortalPassword \
44+
--no-scan \
45+
-DsigningPassword=$SIGNING_PASS \
46+
-DsigningKeyFile=$SIGNING_KEYRING \
47+
'''
48+
}
49+
}
50+
}
51+
}
52+
post {
53+
always {
54+
configFileProvider([configFile(fileId: 'job-configuration.yaml', variable: 'JOB_CONFIGURATION_FILE')]) {
55+
notifyBuildResult maintainers: (String) readYaml(file: env.JOB_CONFIGURATION_FILE).notification?.email?.recipients
56+
}
57+
}
58+
}
59+
}

0 commit comments

Comments
 (0)