From e70127b11b1ebe69939b589fc28d166702fa3a2c Mon Sep 17 00:00:00 2001 From: Kate Anderson Date: Wed, 2 Jul 2025 16:55:48 -0700 Subject: [PATCH 1/2] Update publish steps for logging ext --- .github/workflows/publish_release.yml | 23 ++++++++++++++++++++++- gradle/publish.gradle.kts | 4 ++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 8cd443d..ef62d94 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -15,7 +15,7 @@ jobs: with: distribution: 'temurin' java-version: '8' - - name: Build with Gradle + - name: Build with Gradle and stage artifacts env: SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} @@ -23,3 +23,24 @@ jobs: ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} run: ./gradlew build publish -Prelease=true + + - name: Upload staged artifacts to Central Sonatype + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + run: | + SONATYPE_TOKEN=$(printf "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64) + PUBLISH_NAMESPACE="com.newrelic" + 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 \ No newline at end of file diff --git a/gradle/publish.gradle.kts b/gradle/publish.gradle.kts index 4b52c06..f41a65a 100644 --- a/gradle/publish.gradle.kts +++ b/gradle/publish.gradle.kts @@ -34,8 +34,8 @@ configure { } repositories { maven { - val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/") + val releasesRepoUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/") + val snapshotsRepoUrl = uri("https://central.sonatype.com/repository/maven-snapshots/") url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl configure { From 193fcd6159847f8a1d3d53e5d8f5a7200c9da1a4 Mon Sep 17 00:00:00 2001 From: Kate Anderson Date: Wed, 2 Jul 2025 17:00:06 -0700 Subject: [PATCH 2/2] Update namespace to com.newrelic.logging --- .github/workflows/publish_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index ef62d94..b6188b6 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -30,7 +30,7 @@ jobs: SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} run: | SONATYPE_TOKEN=$(printf "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64) - PUBLISH_NAMESPACE="com.newrelic" + PUBLISH_NAMESPACE="com.newrelic.logging" 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" \