Skip to content

Commit 47d9175

Browse files
committed
[#687] Release via OSSRH
1 parent b478a1f commit 47d9175

File tree

4 files changed

+38
-50
lines changed

4 files changed

+38
-50
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,8 @@ jobs:
218218
IdentityFile ~/.ssh/id_rsa_hibernate.org
219219
- name: Publish documentation on Hibernate.org
220220
run: ./gradlew publishDocumentation -PdocPublishBranch=production
221-
- name: Publish release to Bintray
221+
- name: Publish artifacts to OSSRH, close repository and release
222222
env:
223-
ORG_GRADLE_PROJECT_bintrayUser: ${{ secrets.BINTRAY_USER }}
224-
ORG_GRADLE_PROJECT_bintrayKey: ${{ secrets.BINTRAY_KEY }}
225223
ORG_GRADLE_PROJECT_sonatypeOssrhUser: ${{ secrets.SONATYPE_OSSRH_USER }}
226224
ORG_GRADLE_PROJECT_sonatypeOssrhPassword: ${{ secrets.SONATYPE_OSSRH_PASSWORD }}
227-
run: ./gradlew bintrayUpload bintrayPublish
225+
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository

build.gradle

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,22 @@ plugins {
44
id 'java-library'
55
id 'maven-publish'
66
id 'com.diffplug.gradle.spotless' version '4.0.1'
7-
id 'nu.studer.credentials' version '2.1' apply false
8-
id 'com.jfrog.bintray' version '1.8.5' apply false
7+
id 'nu.studer.credentials' version '2.1'
98
id 'org.asciidoctor.convert' version '1.5.7' apply false
9+
id 'io.github.gradle-nexus.publish-plugin' version '1.0.0'
1010
}
1111

1212
ext {
13+
if (!project.hasProperty('sonatypeOssrhUser')) {
14+
sonatypeOssrhUser = credentials.sonatypeOssrhUser
15+
}
16+
if (!project.hasProperty('sonatypeOssrhPassword')) {
17+
sonatypeOssrhPassword = credentials.sonatypeOssrhPassword
18+
}
19+
}
20+
21+
ext {
22+
projectGroup = 'org.hibernate.reactive'
1323
projectVersionFile = file( "${rootProject.projectDir}/gradle/version.properties" )
1424
projectVersion = Version.parseProjectVersion( readVersionFromProperties( projectVersionFile ) )
1525

@@ -21,12 +31,16 @@ ext {
2131
}
2232
}
2333

34+
// nexusPublishing uses group and version
35+
// as defaults
36+
group = projectGroup
37+
version = projectVersion
38+
2439
// Versions which need to be aligned across modules; this also
2540
// allows overriding the build using a parameter, which can be
2641
// useful to monitor compatibility for upcoming versions on CI:
2742
//
2843
// ./gradlew clean build -PhibernateOrmVersion=5.4.30-SNAPSHOT
29-
3044
ext {
3145
if ( !project.hasProperty('hibernateOrmVersion') ) {
3246
hibernateOrmVersion = '5.4.30.Final'
@@ -62,12 +76,24 @@ ext {
6276

6377
logger.lifecycle "Hibernate ORM Version: " + project.hibernateOrmVersion
6478
logger.lifecycle "Vert.x Version: " + project.vertxVersion
79+
logger.lifecycle "Hibernate Reactive: " + project.version
80+
}
81+
82+
nexusPublishing {
83+
repositories {
84+
sonatype {
85+
username = project.sonatypeOssrhUser
86+
password = project.sonatypeOssrhPassword
87+
}
88+
}
6589
}
6690

6791
subprojects {
6892
apply plugin: 'java-library'
6993
apply plugin: 'com.diffplug.gradle.spotless'
70-
group = 'org.hibernate.reactive'
94+
95+
// FIXME: Also setting the group and version here otherwise not all tasks will find them
96+
group = projectGroup
7197
version = projectVersion
7298

7399
repositories {

documentation/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ task renderReferenceDocumentation(type: AsciidoctorTask, group: 'Documentation')
133133
task assembleDocumentation(dependsOn: [aggregateJavadocs, renderReferenceDocumentation]) {
134134
group 'Documentation'
135135
description 'Grouping task for performing all documentation building tasks'
136+
137+
logger.lifecycle "Documentation groupId: '" + project.group + "', version: '" + project.version + "'"
136138
}
137139

138140
assemble.dependsOn assembleDocumentation

publish.gradle

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
apply plugin: 'maven-publish'
22
apply plugin: 'nu.studer.credentials'
3-
apply plugin: 'com.jfrog.bintray'
43

54
// To publish snapshots:
65
// ./gradlew publish -PjbossNexusUser="<YOUR USERNAME>" -PjbossNexusPassword="<YOUR PASSWORD>"
76
// To release, see task ciRelease in release/build.gradle
7+
// To publish on Sonatype (Maven Central):
8+
// ./gradlew publishToSonatype closeAndReleaseStagingRepository -PsonatypeOssrhUser="<YOUR USERNAME>" -PsonatypeOssrhPassword="<YOUR PASSWORD>"
89

910
ext {
1011
// Credentials can be specified on the command-line using project properties,
@@ -17,18 +18,6 @@ ext {
1718
if (!project.hasProperty('jbossNexusPassword')) {
1819
jbossNexusPassword = credentials.jbossNexusPassword
1920
}
20-
if (!project.hasProperty('bintrayUser')) {
21-
bintrayUser = credentials.bintrayUser
22-
}
23-
if (!project.hasProperty('bintrayKey')) {
24-
bintrayKey = credentials.bintrayKey
25-
}
26-
if (!project.hasProperty('sonatypeOssrhUser')) {
27-
sonatypeOssrhUser = credentials.sonatypeOssrhUser
28-
}
29-
if (!project.hasProperty('sonatypeOssrhPassword')) {
30-
sonatypeOssrhPassword = credentials.sonatypeOssrhPassword
31-
}
3221
}
3322

3423
task sourcesJar(type: Jar) {
@@ -77,6 +66,8 @@ publishing {
7766
}
7867
}
7968
publications {
69+
logger.lifecycle "Publishing groupId: '" + project.group + "', version: '" + project.version + "'"
70+
8071
publishedArtifacts(MavenPublication) {
8172
groupId = project.group
8273
version = project.version
@@ -120,32 +111,3 @@ publishing {
120111
}
121112
}
122113
}
123-
124-
bintray {
125-
user = project.bintrayUser
126-
key = project.bintrayKey
127-
128-
publications = ['publishedArtifacts']
129-
130-
pkg {
131-
userOrg = 'hibernate'
132-
repo = 'artifacts'
133-
name = 'hibernate-reactive'
134-
135-
publish = true
136-
137-
version {
138-
name = project.version
139-
released = new Date()
140-
vcsTag = project.version
141-
gpg {
142-
sign = true
143-
}
144-
mavenCentralSync {
145-
sync = true
146-
user = project.sonatypeOssrhUser
147-
password = project.sonatypeOssrhPassword
148-
}
149-
}
150-
}
151-
}

0 commit comments

Comments
 (0)