@@ -10,9 +10,17 @@ if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) {
1010 return
1111}
1212
13+ def checkoutReleaseScripts() {
14+ dir('.release/scripts') {
15+ checkout scmGit(branches: [[name: '*/main']], extensions: [],
16+ userRemoteConfigs: [[credentialsId: 'ed25519.Hibernate-CI.github.com',
17+ url: 'https://github.com/hibernate/hibernate-release-scripts.git']])
18+ }
19+ }
20+
1321pipeline {
1422 agent {
15- label 'Fedora '
23+ label 'Release '
1624 }
1725 tools {
1826 jdk 'OpenJDK 8 Latest'
@@ -30,16 +38,33 @@ pipeline {
3038 }
3139 stage('Publish') {
3240 steps {
33- configFileProvider([
34- configFile(fileId: 'ci-hibernate.deploy.settings.maven', variable: 'MAVEN_SETTINGS_PATH')
35- ]) {
36- sh '''./gradlew clean publishPublishedArtifactsPublicationToJboss-snapshots-repositoryRepository \
37- -Dmaven.settings=$MAVEN_SETTINGS_PATH \
38- --no-scan
39- '''
41+ script {
42+ withCredentials([
43+ // https://github.com/gradle-nexus/publish-plugin#publishing-to-maven-central-via-sonatype-ossrh
44+ // TODO: HHH-19309:
45+ // Once we switch to maven-central publishing (from nexus2) we need to update credentialsId:
46+ // https://docs.gradle.org/current/samples/sample_publishing_credentials.html#:~:text=via%20environment%20variables
47+ usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'ORG_GRADLE_PROJECT_snapshotsPassword', usernameVariable: 'ORG_GRADLE_PROJECT_snapshotsUsername'),
48+ string(credentialsId: 'Hibernate-CI.github.com', variable: 'JRELEASER_GITHUB_TOKEN'),
49+ // https://docs.gradle.org/current/userguide/publishing_gradle_plugins.html#account_setup
50+ usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'GRADLE_PUBLISH_SECRET', usernameVariable: 'GRADLE_PUBLISH_KEY'),
51+ gitUsernamePassword(credentialsId: 'username-and-token.Hibernate-CI.github.com', gitToolName: 'Default')
52+ ]) {
53+ withEnv([
54+ "DISABLE_REMOTE_GRADLE_CACHE=true"
55+ ]) {
56+ checkoutReleaseScripts()
57+ def version = sh(
58+ script: ".release/scripts/determine-current-version.sh orm",
59+ returnStdout: true
60+ ).trim()
61+ echo "Current version: '${version}'"
62+ sh "bash -xe .release/scripts/snapshot-deploy.sh orm ${version}"
63+ }
64+ }
4065 }
4166 }
42- }
67+ }
4368 }
4469 post {
4570 always {
@@ -48,4 +73,4 @@ pipeline {
4873 }
4974 }
5075 }
51- }
76+ }
0 commit comments