Skip to content

Commit ed23c74

Browse files
committed
Use Portal OSSRH Staging API for publishing
Signed-off-by: Violeta Georgieva <[email protected]>
1 parent 264d689 commit ed23c74

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.github/workflows/publish.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,21 @@ jobs:
181181
ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.SONATYPE_PASSWORD}}
182182
run: |
183183
./gradlew -Dorg.gradle.parallel=false assemble sign artifactoryPublish -Partifactory_publish_contextUrl=https://repo.spring.io -Partifactory_publish_repoKey=libs-release-local publishMavenJavaPublicationToSonatypeRepository
184+
- name: Stage the release
185+
env:
186+
ORG_GRADLE_PROJECT_sonatypeUsername: ${{secrets.SONATYPE_USERNAME}}
187+
ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.SONATYPE_PASSWORD}}
188+
run: |
189+
GRADLE_PUBLISH_MAVEN_AUTHORIZATION=$(echo "${ORG_GRADLE_PROJECT_sonatypeUsername}:${ORG_GRADLE_PROJECT_sonatypePassword}" | base64)
190+
echo "Searching for opened repository..."
191+
REPOSITORY_RESPONSE=$(curl -s -X GET \
192+
-H "Authorization: Bearer ${GRADLE_PUBLISH_MAVEN_AUTHORIZATION}" \
193+
"https://ossrh-staging-api.central.sonatype.com/manual/search/repositories?state=open")
194+
REPOSITORY_KEY=$(echo "${REPOSITORY_RESPONSE}" | grep -o '"key":"[^"]*"' | head -1 | cut -d':' -f2 | tr -d '"')
195+
echo "Triggering uploading..."
196+
curl -s -X POST \
197+
-H "Authorization: Bearer ${GRADLE_PUBLISH_MAVEN_AUTHORIZATION}" \
198+
"https://ossrh-staging-api.central.sonatype.com/manual/upload/repository/${REPOSITORY_KEY}?publishing_type=user_managed"
184199
185200
tagMilestone:
186201
name: Tag milestone

gradle/setup.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ publishing {
9696
if (qualifyVersion("$version") == "RELEASE") {
9797
maven {
9898
name = "sonatype"
99-
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
99+
url = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"
100100
credentials {
101101
username findProperty("sonatypeUsername")
102102
password findProperty("sonatypePassword")

0 commit comments

Comments
 (0)