Skip to content

Commit 3c9ee09

Browse files
committed
[Java] Publish artifacts to Central Portal using OSSRH Staging API.
1 parent e926d3a commit 3c9ee09

File tree

7 files changed

+308
-34
lines changed

7 files changed

+308
-34
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ jobs:
5757
- name: Setup Gradle
5858
uses: gradle/actions/setup-gradle@v4
5959
- name: Publish with Gradle
60-
run: ./gradlew publish
60+
run: ./gradlew publish uploadArtifactsToCentralPortal
6161
env:
62-
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.SONATYPE_CENTRAL_USERNAME }}
63-
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.SONATYPE_CENTRAL_PASSWORD }}
64-
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_RSA_SIGN_KEY }}
65-
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_RSA_SIGN_KEYPASS }}
62+
SIGNING_GPG_SECRET_KEY: ${{ secrets.GPG_RSA_SIGN_KEY }}
63+
SIGNING_GPG_PASSWORD: ${{ secrets.GPG_RSA_SIGN_KEYPASS }}
64+
SONATYPE_CENTRAL_PORTAL_USERNAME: ${{ secrets.SONATYPE_CENTRAL_PORTAL_USERNAME }}
65+
SONATYPE_CENTRAL_PORTAL_PASSWORD: ${{ secrets.SONATYPE_CENTRAL_PORTAL_PASSWORD }}

.gitignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,16 @@
1919
build-local.properties
2020
deps
2121
*/bin
22-
build
23-
.gradle
24-
target
22+
build/
23+
!buildSrc/
24+
!buildSrc/src/**/build
25+
.gradle/
26+
target/
2527
GTAGS
2628
GRTAGS
2729
GPATH
2830
prop
29-
out
31+
out/
3032
.vs/
3133
.vscode
3234

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [1.35.2] - 2025-06-06
4+
### Changed
5+
* Publish release artifacts to Central Portal using OSSRH Staging API service.
6+
* Bump `Agrona` to 2.2.2.
7+
* Bump `Checkstyle` to 10.25.0.
8+
39
## [1.35.1] - 2025-06-02
410
### Changed
511
* Bump `Agrona` to 2.2.1.
@@ -74,6 +80,7 @@
7480
* **Java:** Prevent collision when field name is 'value'.
7581
* **Java:** Preserve byte order throughout IR transformations.
7682

83+
[1.35.2]: https://github.com/aeron-io/simple-binary-encoding/releases/tag/1.35.2
7784
[1.35.1]: https://github.com/aeron-io/simple-binary-encoding/releases/tag/1.35.1
7885
[1.35.0]: https://github.com/aeron-io/simple-binary-encoding/releases/tag/1.35.0
7986
[1.34.1]: https://github.com/aeron-io/simple-binary-encoding/releases/tag/1.34.1

build.gradle

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,30 @@ def toolchainLauncher = javaToolchains.launcherFor {
5353
def sbeGroup = 'uk.co.real-logic'
5454
def sbeVersion = file('version.txt').text.trim()
5555

56-
ext {
57-
isReleaseVersion = !sbeVersion.endsWith('-SNAPSHOT')
58-
releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
59-
snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
60-
61-
if (!project.hasProperty('ossrhUsername')) {
62-
ossrhUsername = ''
56+
def getConfigProperty(final String projectPropertyName, final String envVarName) {
57+
String value = project.findProperty(projectPropertyName)
58+
if (!value) {
59+
value = System.getenv(envVarName)
60+
if (!value) {
61+
return null
62+
}
6363
}
6464

65-
if (!project.hasProperty('ossrhPassword')) {
66-
ossrhPassword = ''
67-
}
65+
value = value.trim()
6866

69-
if (!project.hasProperty('signingKey')) {
70-
signingKey = null
71-
}
67+
return value ? value : null
68+
}
7269

73-
if (!project.hasProperty('signingPassword')) {
74-
signingPassword = null
75-
}
70+
ext {
71+
isReleaseVersion = !sbeVersion.endsWith('-SNAPSHOT')
72+
73+
sonatypeCentralPortalReleasesRepoUrl = 'https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/'
74+
sonatypeCentralPortalSnapshotsRepoUrl = 'https://central.sonatype.com/repository/maven-snapshots/'
75+
sonatypeCentralPortalUsername = getConfigProperty('sonatypeCentralPortalUsername', 'SONATYPE_CENTRAL_PORTAL_USERNAME')
76+
sonatypeCentralPortalPassword = getConfigProperty('sonatypeCentralPortalPassword', 'SONATYPE_CENTRAL_PORTAL_PASSWORD')
77+
78+
signingKey = getConfigProperty('signingKey', 'SIGNING_GPG_SECRET_KEY') // NOTE: ASCII armored secret key
79+
signingPassword = getConfigProperty('signingPassword', 'SIGNING_GPG_PASSWORD') // NOTE: Plain text
7680
}
7781

7882
def projectPom = {
@@ -389,10 +393,10 @@ project(':sbe-tool') {
389393

390394
repositories {
391395
maven {
392-
url = !isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl
396+
url = !isReleaseVersion ? sonatypeCentralPortalSnapshotsRepoUrl : sonatypeCentralPortalReleasesRepoUrl
393397
credentials {
394-
username = ossrhUsername
395-
password = ossrhPassword
398+
username = sonatypeCentralPortalUsername
399+
password = sonatypeCentralPortalPassword
396400
}
397401
}
398402
}
@@ -459,10 +463,10 @@ project(':sbe-all') {
459463
}
460464
repositories {
461465
maven {
462-
url = !isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl
466+
url = !isReleaseVersion ? sonatypeCentralPortalSnapshotsRepoUrl : sonatypeCentralPortalReleasesRepoUrl
463467
credentials {
464-
username = ossrhUsername
465-
password = ossrhPassword
468+
username = sonatypeCentralPortalUsername
469+
password = sonatypeCentralPortalPassword
466470
}
467471
}
468472
}
@@ -579,10 +583,10 @@ project(':sbe-samples') {
579583

580584
repositories {
581585
maven {
582-
url = !isReleaseVersion ? snapshotsRepoUrl : releasesRepoUrl
586+
url = !isReleaseVersion ? sonatypeCentralPortalSnapshotsRepoUrl : sonatypeCentralPortalReleasesRepoUrl
583587
credentials {
584-
username = ossrhUsername
585-
password = ossrhPassword
588+
username = sonatypeCentralPortalUsername
589+
password = sonatypeCentralPortalPassword
586590
}
587591
}
588592
}
@@ -1115,6 +1119,13 @@ tasks.named('dependencyUpdates').configure {
11151119
}
11161120
}
11171121

1122+
tasks.register('uploadArtifactsToCentralPortal', uk.co.real_logic.sbe.build.SonatypeCentralPortalUploadRepositoryTask) {
1123+
portalUsername.set(sonatypeCentralPortalUsername)
1124+
portalPassword.set(sonatypeCentralPortalPassword)
1125+
groupId.set(aeronGroup)
1126+
snapshotRelease.set(!isReleaseVersion)
1127+
}
1128+
11181129
wrapper {
11191130
distributionType = 'ALL'
11201131
}

buildSrc/build.gradle

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repositories {
2+
mavenCentral()
3+
}
4+
5+
configurations.configureEach {
6+
resolutionStrategy {
7+
failOnVersionConflict()
8+
}
9+
}
10+
11+
dependencies {
12+
implementation libs.json
13+
}
14+
15+
tasks.withType(JavaCompile).configureEach {
16+
configure(options) {
17+
options.compilerArgs << '-Xlint:deprecation' << '-Xlint:unchecked' // examples
18+
}
19+
}

buildSrc/settings.gradle

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dependencyResolutionManagement {
2+
versionCatalogs {
3+
create("libs") {
4+
from(files("../gradle/libs.versions.toml"))
5+
}
6+
}
7+
}

0 commit comments

Comments
 (0)