Skip to content

Commit 0d88266

Browse files
committed
Use Portal OSSRH Staging API for publishing
Signed-off-by: Violeta Georgieva <696661+violetagg@users.noreply.github.com>
1 parent 4afd043 commit 0d88266

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
@@ -99,6 +99,21 @@ jobs:
9999
ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.SONATYPE_PASSWORD}}
100100
run: |
101101
./gradlew assemble sign artifactoryPublish -Partifactory_publish_contextUrl=https://repo.spring.io -Partifactory_publish_repoKey=libs-release-local publishMavenJavaPublicationToSonatypeRepository
102+
- name: Stage the release
103+
env:
104+
ORG_GRADLE_PROJECT_sonatypeUsername: ${{secrets.SONATYPE_USERNAME}}
105+
ORG_GRADLE_PROJECT_sonatypePassword: ${{secrets.SONATYPE_PASSWORD}}
106+
run: |
107+
GRADLE_PUBLISH_MAVEN_AUTHORIZATION=$(echo "${ORG_GRADLE_PROJECT_sonatypeUsername}:${ORG_GRADLE_PROJECT_sonatypePassword}" | base64)
108+
echo "Searching for opened repository..."
109+
REPOSITORY_RESPONSE=$(curl -s -X GET \
110+
-H "Authorization: Bearer ${GRADLE_PUBLISH_MAVEN_AUTHORIZATION}" \
111+
"https://ossrh-staging-api.central.sonatype.com/manual/search/repositories?state=open")
112+
REPOSITORY_KEY=$(echo "${REPOSITORY_RESPONSE}" | grep -o '"key":"[^"]*"' | head -1 | cut -d':' -f2 | tr -d '"')
113+
echo "Triggering uploading..."
114+
curl -s -X POST \
115+
-H "Authorization: Bearer ${GRADLE_PUBLISH_MAVEN_AUTHORIZATION}" \
116+
"https://ossrh-staging-api.central.sonatype.com/manual/upload/repository/${REPOSITORY_KEY}?publishing_type=user_managed"
102117
103118
tagMilestone:
104119
name: Tag milestone

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ publishing {
144144
if (qualifyVersion("$version") == "RELEASE") {
145145
maven {
146146
name = "sonatype"
147-
url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
147+
url = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"
148148
credentials {
149149
username findProperty("sonatypeUsername")
150150
password findProperty("sonatypePassword")

0 commit comments

Comments
 (0)