From 377ba2f3bbcdf96ff07775c78d4203b87bc51360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Van=C4=9Bk?= Date: Mon, 18 Aug 2025 18:22:25 +0200 Subject: [PATCH] #158 publishing artifacts by using the portal OSSRH staging API --- .github/workflows/release.yml | 20 ++++++++++++++++++++ pom.xml | 4 ++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 096409a0..98352d0f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,3 +33,23 @@ jobs: MAVEN_PASS: ${{ secrets.MAVEN_PASS }} SIGNING_PASS: ${{ secrets.SIGNING_PASS }} run: mvn -B release:prepare release:perform -DreleaseVersion=$RELEASE_VERSION + - name: Upload staged artifacts to Central Sonatype + env: + SONATYPE_USERNAME: ${{ secrets.MAVEN_USER }} + SONATYPE_PASSWORD: ${{ secrets.MAVEN_PASS }} + run: | + SONATYPE_TOKEN=$(printf "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64) + PUBLISH_NAMESPACE="io.zonky" + echo "Uploading artifacts from OSSRH-Staging to Central Sonatype..." + RESPONSE=$(curl -s -w "%{http_code}" -o response_body.txt -X POST \ + -H "Authorization: Bearer $SONATYPE_TOKEN" \ + "https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/$PUBLISH_NAMESPACE?publishing_type=user_managed") + if [ "$RESPONSE" -ne 200 ]; then + echo "Failed to upload artifacts to Central Sonatype. Response code: $RESPONSE. Response body: " + cat response_body.txt + echo "Visit https://central.sonatype.com/publishing/deployments for more information." + exit 1 + else + echo "Artifacts were uploaded successfully to Central Sonatype." + echo "Visit https://central.sonatype.com/publishing/deployments to view your artifacts." + fi diff --git a/pom.xml b/pom.xml index 77f28187..33b1105a 100644 --- a/pom.xml +++ b/pom.xml @@ -83,11 +83,11 @@ ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ + https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/ ossrh - https://oss.sonatype.org/content/repositories/snapshots + https://central.sonatype.com/repository/maven-snapshots/