Skip to content

Commit 960528b

Browse files
committed
1 parent 73e53d7 commit 960528b

File tree

5 files changed

+137
-237
lines changed

5 files changed

+137
-237
lines changed

build.gradle

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -43,81 +43,30 @@ apply from: file( 'gradle/module.gradle' )
4343
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4444
// Release Task
4545

46-
task release {
46+
tasks.register('release') {
4747
description = "The task performed when we are performing a release build. Relies on " +
4848
"the fact that subprojects will appropriately define a release task " +
4949
"themselves if they have any release-related activities to perform"
5050

5151
doFirst {
5252
def javaVersionsInUse = jdkVersions.allVersions
53-
if ( javaVersionsInUse != [JavaLanguageVersion.of( 11 )].toSet() ) {
54-
throw new IllegalStateException( "Please use JDK 11 to perform the release. Currently using: ${javaVersionsInUse}" )
53+
if (javaVersionsInUse != [JavaLanguageVersion.of(17)].toSet()) {
54+
throw new IllegalStateException("Please use JDK 17 to perform the release. Currently using: ${javaVersionsInUse}")
5555
}
5656
}
5757
}
5858

59-
task publish {
60-
description = "The task performed when we want to just publish maven artifacts. Relies on " +
61-
"the fact that subprojects will appropriately define a release task " +
62-
"themselves if they have any publish-related activities to perform"
63-
}
64-
65-
66-
67-
def ossrhUsername = extractPropertyOrSetting( "OSSRH_USER" )
68-
def ossrhPassword = extractPropertyOrSetting( "OSSRH_PASSWORD" )
69-
70-
String extractPropertyOrSetting(String name) {
71-
if ( project.hasProperty( name) ) {
72-
return project.property( name )
73-
}
74-
75-
def sysProp = System.getProperty( name )
76-
if ( sysProp != null ) {
77-
return sysProp
78-
}
79-
80-
def envProp = System.getenv( name )
81-
if ( envProp != null ) {
82-
return envProp
83-
}
84-
85-
return null
86-
}
87-
8859
nexusPublishing {
8960
repositories {
90-
sonatype {
91-
username = ossrhUsername
92-
password = ossrhPassword
93-
}
61+
sonatype()
9462
}
9563
}
9664

97-
gradle.taskGraph.addTaskExecutionGraphListener(
98-
new TaskExecutionGraphListener() {
99-
@Override
100-
void graphPopulated(TaskExecutionGraph graph) {
101-
for ( final def task in graph.allTasks ) {
102-
if ( task instanceof PublishToMavenRepository ) {
103-
if ( ossrhUsername == null ) {
104-
throw new RuntimeException( "OSSRH username not specified, but publishing was requested" )
105-
}
106-
if ( ossrhPassword == null ) {
107-
throw new RuntimeException( "OSSRH password not specified, but publishing was requested" )
108-
}
109-
break
110-
}
111-
}
112-
}
113-
}
114-
)
115-
11665

11766
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11867
// CI Build Task
11968

120-
task ciBuild {
69+
tasks.register('ciBuild') {
12170
description = "The task performed when one of the 'main' jobs are triggered on the " +
12271
"CI server. Just as above, relies on the fact that subprojects will " +
12372
"appropriately define a release task themselves if they have any tasks " +

ci/release/Jenkinsfile

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ def checkoutReleaseScripts() {
5353
}
5454
}
5555

56-
File findReleaseNotes() {
57-
}
5856

5957
// --------------------------------------------
6058
// Pipeline
@@ -95,6 +93,10 @@ pipeline {
9593
stage('Release check') {
9694
steps {
9795
script {
96+
print "INFO: params.RELEASE_VERSION = ${params.RELEASE_VERSION}"
97+
print "INFO: params.DEVELOPMENT_VERSION = ${params.DEVELOPMENT_VERSION}"
98+
print "INFO: params.RELEASE_DRY_RUN? = ${params.RELEASE_DRY_RUN}"
99+
98100
checkoutReleaseScripts()
99101

100102
def currentVersion = Version.parseDevelopmentVersion( sh(
@@ -110,7 +112,9 @@ pipeline {
110112
echo "Release was requested manually"
111113

112114
if ( !params.RELEASE_VERSION ) {
113-
throw new IllegalArgumentException( 'Missing value for parameter RELEASE_VERSION. This parameter must be set explicitly to prevent mistakes.' )
115+
throw new IllegalArgumentException(
116+
'Missing value for parameter RELEASE_VERSION. This parameter must be set explicitly to prevent mistakes.'
117+
)
114118
}
115119
releaseVersion = Version.parseReleaseVersion( params.RELEASE_VERSION )
116120

@@ -152,7 +156,7 @@ pipeline {
152156
env.DEVELOPMENT_VERSION = developmentVersion.toString()
153157

154158
if ( params.RELEASE_DRY_RUN ) {
155-
env.SCRIPT_OPTIONS += " -d"
159+
env.SCRIPT_OPTIONS += "-d"
156160
}
157161

158162
// Determine version id to check if Jira version exists
@@ -169,25 +173,18 @@ pipeline {
169173
configFile(fileId: 'release.config.ssh', targetLocation: "${env.HOME}/.ssh/config"),
170174
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
171175
]) {
172-
withCredentials([
173-
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'OSSRH_PASSWORD', usernameVariable: 'OSSRH_USER'),
174-
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'PLUGIN_PORTAL_PASSWORD', usernameVariable: 'PLUGIN_PORTAL_USERNAME'),
175-
file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
176-
string(credentialsId: 'release.gpg.passphrase', variable: 'RELEASE_GPG_PASSPHRASE')
177-
]) {
178-
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
179-
// set release version
180-
// update changelog from JIRA
181-
// tags the version
182-
// changes the version to the provided development version
183-
withEnv([
184-
"BRANCH=${env.GIT_BRANCH}",
185-
"DISABLE_REMOTE_GRADLE_CACHE=true",
186-
// Increase the amount of memory for this part since asciidoctor doc rendering consumes a lot of metaspace
187-
"GRADLE_OPTS=-Dorg.gradle.jvmargs='-Dlog4j2.disableJmx -Xmx4g -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8'"
188-
]) {
189-
sh ".release/scripts/prepare-release.sh ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION}"
190-
}
176+
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
177+
// set release version
178+
// update changelog from JIRA
179+
// tags the version
180+
// changes the version to the provided development version
181+
withEnv([
182+
"BRANCH=${env.GIT_BRANCH}",
183+
"DISABLE_REMOTE_GRADLE_CACHE=true",
184+
// Increase the amount of memory for this part since asciidoctor doc rendering consumes a lot of metaspace
185+
"GRADLE_OPTS=-Dorg.gradle.jvmargs='-Dlog4j2.disableJmx -Xmx4g -XX:MaxMetaspaceSize=768m -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8'"
186+
]) {
187+
sh ".release/scripts/prepare-release.sh ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION}"
191188
}
192189
}
193190
}
@@ -204,10 +201,12 @@ pipeline {
204201
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
205202
]) {
206203
withCredentials([
207-
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'OSSRH_PASSWORD', usernameVariable: 'OSSRH_USER'),
208-
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'PLUGIN_PORTAL_PASSWORD', usernameVariable: 'PLUGIN_PORTAL_USERNAME'),
209-
file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
210-
string(credentialsId: 'release.gpg.passphrase', variable: 'RELEASE_GPG_PASSPHRASE'),
204+
// https://github.com/gradle-nexus/publish-plugin#publishing-to-maven-central-via-sonatype-ossrh
205+
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'ORG_GRADLE_PROJECT_sonatypePassword', usernameVariable: 'ORG_GRADLE_PROJECT_sonatypeUsername'),
206+
// https://docs.gradle.org/current/userguide/publishing_gradle_plugins.html#account_setup
207+
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'GRADLE_PUBLISH_SECRET', usernameVariable: 'GRADLE_PUBLISH_KEY'),
208+
file(credentialsId: 'release.gpg.private-key', variable: 'SIGNING_GPG_PRIVATE_KEY_PATH'),
209+
string(credentialsId: 'release.gpg.passphrase', variable: 'SIGNING_GPG_PASSPHRASE')
211210
gitUsernamePassword(credentialsId: 'username-and-token.Hibernate-CI.github.com', gitToolName: 'Default')
212211
]) {
213212
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
@@ -216,7 +215,7 @@ pipeline {
216215
withEnv([
217216
"DISABLE_REMOTE_GRADLE_CACHE=true"
218217
]) {
219-
sh ".release/scripts/publish.sh ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION} ${env.GIT_BRANCH} ${env.SCRIPT_OPTIONS}"
218+
sh ".release/scripts/publish.sh ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION} ${env.GIT_BRANCH}"
220219
}
221220
}
222221
}
@@ -243,7 +242,7 @@ pipeline {
243242
extensions: [],
244243
userRemoteConfigs: [[credentialsId: 'ed25519.Hibernate-CI.github.com', url: 'https://github.com/hibernate/hibernate.org.git']]
245244
)
246-
sh "../scripts/website-release.sh ${env.PROJECT} ${env.RELEASE_VERSION} ${env.SCRIPT_OPTIONS} "
245+
sh "../scripts/website-release.sh ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION}"
247246
}
248247
}
249248
}

ci/snapshot-publish.Jenkinsfile

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,19 @@ pipeline {
3030
}
3131
stage('Publish') {
3232
steps {
33-
withCredentials([
34-
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'OSSRH_PASSWORD', usernameVariable: 'OSSRH_USER'),
35-
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'PLUGIN_PORTAL_PASSWORD', usernameVariable: 'PLUGIN_PORTAL_USERNAME'),
36-
file(credentialsId: 'release.gpg.private-key', variable: 'RELEASE_GPG_PRIVATE_KEY_PATH'),
37-
string(credentialsId: 'release.gpg.passphrase', variable: 'RELEASE_GPG_PASSPHRASE'),
38-
// https://github.com/gradle-nexus/publish-plugin#publishing-to-maven-central-via-sonatype-ossrh
39-
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'ORG_GRADLE_PROJECT_sonatypePassword', usernameVariable: 'ORG_GRADLE_PROJECT_sonatypeUsername'),
40-
// https://docs.gradle.org/current/userguide/publishing_gradle_plugins.html#account_setup
41-
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'GRADLE_PUBLISH_SECRET', usernameVariable: 'GRADLE_PUBLISH_KEY'),
42-
file(credentialsId: 'release.gpg.private-key', variable: 'SIGNING_GPG_PRIVATE_KEY_PATH'),
43-
string(credentialsId: 'release.gpg.passphrase', variable: 'SIGNING_GPG_PASSPHRASE')
44-
]) {
33+
withCredentials([
34+
// https://github.com/gradle-nexus/publish-plugin#publishing-to-maven-central-via-sonatype-ossrh
35+
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'ORG_GRADLE_PROJECT_sonatypePassword', usernameVariable: 'ORG_GRADLE_PROJECT_sonatypeUsername'),
36+
// https://docs.gradle.org/current/userguide/publishing_gradle_plugins.html#account_setup
37+
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'GRADLE_PUBLISH_SECRET', usernameVariable: 'GRADLE_PUBLISH_KEY'),
38+
file(credentialsId: 'release.gpg.private-key', variable: 'SIGNING_GPG_PRIVATE_KEY_PATH'),
39+
string(credentialsId: 'release.gpg.passphrase', variable: 'SIGNING_GPG_PASSPHRASE')
40+
gitUsernamePassword(credentialsId: 'username-and-token.Hibernate-CI.github.com', gitToolName: 'Default')
41+
]) {
4542
withEnv([
4643
"DISABLE_REMOTE_GRADLE_CACHE=true"
4744
]) {
48-
sh '''./gradlew clean publish -x test \
49-
--no-scan --no-daemon --no-build-cache --stacktrace
50-
'''
45+
sh './gradlew clean publish -x test --no-scan --no-daemon --no-build-cache --stacktrace'
5146
}
5247
}
5348
}

0 commit comments

Comments
 (0)