Skip to content

Commit 4cd7e5a

Browse files
committed
1 parent 7f8b685 commit 4cd7e5a

File tree

4 files changed

+126
-223
lines changed

4 files changed

+126
-223
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(11)].toSet()) {
54+
throw new IllegalStateException("Please use JDK 11 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: 27 additions & 30 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(
@@ -152,7 +154,7 @@ pipeline {
152154
env.DEVELOPMENT_VERSION = developmentVersion.toString()
153155

154156
if ( params.RELEASE_DRY_RUN ) {
155-
env.SCRIPT_OPTIONS += " -d"
157+
env.SCRIPT_OPTIONS += "-d"
156158
}
157159

158160
// Determine version id to check if Jira version exists
@@ -169,27 +171,20 @@ pipeline {
169171
configFile(fileId: 'release.config.ssh', targetLocation: "${env.HOME}/.ssh/config"),
170172
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
171173
]) {
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-
}
191-
}
192-
}
174+
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
175+
// set release version
176+
// update changelog from JIRA
177+
// tags the version
178+
// changes the version to the provided development version
179+
withEnv([
180+
"BRANCH=${env.GIT_BRANCH}",
181+
"DISABLE_REMOTE_GRADLE_CACHE=true",
182+
// Increase the amount of memory for this part since asciidoctor doc rendering consumes a lot of metaspace
183+
"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'"
184+
]) {
185+
sh ".release/scripts/prepare-release.sh ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION}"
186+
}
187+
}
193188
}
194189
}
195190
}
@@ -204,10 +199,12 @@ pipeline {
204199
configFile(fileId: 'release.config.ssh.knownhosts', targetLocation: "${env.HOME}/.ssh/known_hosts")
205200
]) {
206201
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'),
202+
// https://github.com/gradle-nexus/publish-plugin#publishing-to-maven-central-via-sonatype-ossrh
203+
usernamePassword(credentialsId: 'ossrh.sonatype.org', passwordVariable: 'ORG_GRADLE_PROJECT_sonatypePassword', usernameVariable: 'ORG_GRADLE_PROJECT_sonatypeUsername'),
204+
// https://docs.gradle.org/current/userguide/publishing_gradle_plugins.html#account_setup
205+
usernamePassword(credentialsId: 'gradle-plugin-portal-api-key', passwordVariable: 'GRADLE_PUBLISH_SECRET', usernameVariable: 'GRADLE_PUBLISH_KEY'),
206+
file(credentialsId: 'release.gpg.private-key', variable: 'SIGNING_GPG_PRIVATE_KEY_PATH'),
207+
string(credentialsId: 'release.gpg.passphrase', variable: 'SIGNING_GPG_PASSPHRASE')
211208
gitUsernamePassword(credentialsId: 'username-and-token.Hibernate-CI.github.com', gitToolName: 'Default')
212209
]) {
213210
sshagent(['ed25519.Hibernate-CI.github.com', 'hibernate.filemgmt.jboss.org', 'hibernate-ci.frs.sourceforge.net']) {
@@ -216,7 +213,7 @@ pipeline {
216213
withEnv([
217214
"DISABLE_REMOTE_GRADLE_CACHE=true"
218215
]) {
219-
sh ".release/scripts/publish.sh ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION} ${env.GIT_BRANCH} ${env.SCRIPT_OPTIONS}"
216+
sh ".release/scripts/publish.sh ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION} ${env.DEVELOPMENT_VERSION} ${env.GIT_BRANCH}"
220217
}
221218
}
222219
}
@@ -243,7 +240,7 @@ pipeline {
243240
extensions: [],
244241
userRemoteConfigs: [[credentialsId: 'ed25519.Hibernate-CI.github.com', url: 'https://github.com/hibernate/hibernate.org.git']]
245242
)
246-
sh "../scripts/website-release.sh ${env.PROJECT} ${env.RELEASE_VERSION} ${env.SCRIPT_OPTIONS} "
243+
sh "../scripts/website-release.sh ${env.SCRIPT_OPTIONS} ${env.PROJECT} ${env.RELEASE_VERSION}"
247244
}
248245
}
249246
}

0 commit comments

Comments
 (0)