Skip to content

Commit

Permalink
[#1956] Add Jenkins publish snapshots pipeline configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideD committed Sep 17, 2024
1 parent 00c5856 commit 92a4a76
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions ci/snapshot-publish.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* See https://github.com/hibernate/hibernate-jenkins-pipeline-helpers
*/
@Library('hibernate-jenkins-pipeline-helpers@1.13') _

// Avoid running the pipeline on branch indexing
if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) {
print "INFO: Build skipped due to trigger being Branch Indexing"
currentBuild.result = 'NOT_BUILT'
return
}

pipeline {
agent {
label 'Fedora'
}
tools {
jdk 'OpenJDK 11 Latest'
}
options {
rateLimitBuilds(throttle: [count: 1, durationName: 'hour', userBoost: true])
buildDiscarder(logRotator(numToKeepStr: '3', artifactNumToKeepStr: '3'))
disableConcurrentBuilds(abortPrevious: true)
}
stages {
stage('Checkout') {
steps {
checkout scm
}
}
stage('Publish') {
steps {
withCredentials([
usernamePassword(credentialsId: 'ossrh.sonatype.org', usernameVariable: 'hibernatePublishUsername', passwordVariable: 'hibernatePublishPassword'),
usernamePassword(credentialsId: 'plugins.gradle.org', usernameVariable: 'hibernatePluginPortalUsername', passwordVariable: 'hibernatePluginPortalPassword'),
string(credentialsId: 'release.gpg.passphrase', variable: 'SIGNING_PASS'),
file(credentialsId: 'release.gpg.private-key', variable: 'SIGNING_KEYRING')
]) {
sh '''./gradlew clean publish \
-PhibernatePublishUsername=$hibernatePublishUsername \
-PhibernatePublishPassword=$hibernatePublishPassword \
-Pgradle.publish.key=$hibernatePluginPortalUsername \
-Pgradle.publish.secret=$hibernatePluginPortalPassword \
--no-scan \
-DsigningPassword=$SIGNING_PASS \
-DsigningKeyFile=$SIGNING_KEYRING \
'''
}
}
}
}
post {
always {
configFileProvider([configFile(fileId: 'job-configuration.yaml', variable: 'JOB_CONFIGURATION_FILE')]) {
notifyBuildResult maintainers: (String) readYaml(file: env.JOB_CONFIGURATION_FILE).notification?.email?.recipients
}
}
}
}

0 comments on commit 92a4a76

Please sign in to comment.