From f99b2aaef884da0fbe4ade56df98c8a037e974a3 Mon Sep 17 00:00:00 2001 From: MV Shiva Date: Tue, 24 Jun 2025 10:12:35 +0530 Subject: [PATCH] release: Migrate artifacts publishing from legacy OSSRH to Central Portal (#12156) --- README.md | 2 +- RELEASING.md | 2 +- build.gradle | 8 ++++---- buildscripts/sonatype-upload.sh | 17 ++++++++++++++++- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 012eab498e..a925d1535f 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ For [Bazel](https://bazel.build), you can either https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.73.0 Development snapshots are available in [Sonatypes's snapshot -repository](https://oss.sonatype.org/content/repositories/snapshots/). +repository](https://central.sonatype.com/repository/maven-snapshots/). Generated Code -------------- diff --git a/RELEASING.md b/RELEASING.md index 120b0ea6ac..c57829b8c2 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -160,7 +160,7 @@ Tagging the Release repository can then be `released`, which will begin the process of pushing the new artifacts to Maven Central (the staging repository will be destroyed in the process). You can see the complete process for releasing to Maven - Central on the [OSSRH site](https://central.sonatype.org/pages/releasing-the-deployment.html). + Central on the [OSSRH site](https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#deploying). 10. We have containers for each release to detect compatibility regressions with old releases. Generate one for the new release by following the [GCR image diff --git a/build.gradle b/build.gradle index 089c78639b..afea703923 100644 --- a/build.gradle +++ b/build.gradle @@ -389,11 +389,11 @@ subprojects { url = new File(rootProject.repositoryDir).toURI() } else { String stagingUrl + String baseUrl = "https://ossrh-staging-api.central.sonatype.com/service/local" if (rootProject.hasProperty('repositoryId')) { - stagingUrl = 'https://oss.sonatype.org/service/local/staging/deployByRepositoryId/' + - rootProject.repositoryId + stagingUrl = "${baseUrl}/staging/deployByRepositoryId/" + rootProject.repositoryId } else { - stagingUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' + stagingUrl = "${baseUrl}/staging/deploy/maven2/" } credentials { if (rootProject.hasProperty('ossrhUsername') && rootProject.hasProperty('ossrhPassword')) { @@ -402,7 +402,7 @@ subprojects { } } def releaseUrl = stagingUrl - def snapshotUrl = 'https://oss.sonatype.org/content/repositories/snapshots/' + def snapshotUrl = 'https://central.sonatype.com/repository/maven-snapshots/' url = version.endsWith('SNAPSHOT') ? snapshotUrl : releaseUrl } } diff --git a/buildscripts/sonatype-upload.sh b/buildscripts/sonatype-upload.sh index 1663714912..4baa4e46ca 100755 --- a/buildscripts/sonatype-upload.sh +++ b/buildscripts/sonatype-upload.sh @@ -59,7 +59,7 @@ if [ -z "$USERNAME" -o -z "$PASSWORD" ]; then exit 1 fi -STAGING_URL="https://oss.sonatype.org/service/local/staging" +STAGING_URL="https://ossrh-staging-api.central.sonatype.com/service/local/staging" # We go through the effort of using deloyByRepositoryId/ because it is # _substantially_ faster to upload files than deploy/maven2/. When using @@ -108,3 +108,18 @@ XML=" " curl --fail-with-body -X POST -d "$XML" -u "$USERPASS" -H "Content-Type: application/xml" \ "$STAGING_URL/profiles/$PROFILE_ID/finish" + +# TODO (okshiva): After 2-3 releases make it automatic. +# After closing the repository on the staging API, we must manually trigger +# its upload to the main Central Publisher Portal. We set publishing_type=automatic +# to have it release automatically upon passing validation. +# echo "Triggering release of repository ${REPOID} to the Central Portal" + +# MANUAL_API_URL="https://ossrh-staging-api.central.sonatype.com/service/local/manual" + +#curl --fail-with-body -X POST \ +# -H "Authorization: Bearer ${USERPASS}" \ +# -H "Content-Type: application/json" \ +# "${MANUAL_API_URL}/upload/repository/${REPOID}?publishing_type=automatic" + +# echo "Release triggered. Monitor progress at https://central.sonatype.com/publishing/deployments"