From 64d7fc4f5055e5fe4e4963608782448bf6cfc4dd Mon Sep 17 00:00:00 2001 From: lovesh-ap Date: Wed, 11 Jun 2025 15:31:45 +0530 Subject: [PATCH 1/9] Migrate publisher to Central Sonatype Update group id for test --- build.gradle | 2 +- .../src/main/java/com/nr/builder/publish/PublishConfig.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 2ce4efad3..2382632d1 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ allprojects { } } - group = 'com.newrelic.agent.java.security' + group = 'io.github.lovesh-ap.agent.java.security' version = agentVersion + (project.findProperty("release") == "true" ? "" : "-SNAPSHOT") version = version + (project.findProperty("release-suffix") != null ? project.findProperty("release-suffix") : "") idea.module { diff --git a/buildSrc/src/main/java/com/nr/builder/publish/PublishConfig.java b/buildSrc/src/main/java/com/nr/builder/publish/PublishConfig.java index 46b593994..e208b2ec6 100644 --- a/buildSrc/src/main/java/com/nr/builder/publish/PublishConfig.java +++ b/buildSrc/src/main/java/com/nr/builder/publish/PublishConfig.java @@ -59,8 +59,8 @@ private static void configureSigning(Project project, MavenPublication publicati } private static void configureRepo(MavenArtifactRepository repo, String projectVersion) { - URI releasesRepoUri = URI.create("https://oss.sonatype.org/service/local/staging/deploy/maven2/"); - URI snapshotsRepoUrl = URI.create("https://oss.sonatype.org/content/repositories/snapshots/"); + URI releasesRepoUri = URI.create("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"); + URI snapshotsRepoUrl = URI.create("https://ossrh-staging-api.central.sonatype.com/content/repositories/snapshots/"); repo.setUrl( projectVersion.endsWith("SNAPSHOT") ? snapshotsRepoUrl From 7b19fdfd537b3567730e5bdba35b8022558f40eb Mon Sep 17 00:00:00 2001 From: lovesh-ap Date: Thu, 12 Jun 2025 10:00:21 +0530 Subject: [PATCH 2/9] add the curl step to promote (release) all artifacts that were previously published to the staging repository --- .github/workflows/publish-to-maven.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/publish-to-maven.yml b/.github/workflows/publish-to-maven.yml index dc2d715aa..55c534d76 100644 --- a/.github/workflows/publish-to-maven.yml +++ b/.github/workflows/publish-to-maven.yml @@ -128,6 +128,31 @@ jobs: ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} + - name: Upload staged artifacts to Central Sonatype + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + run: | + # token is a b64-encoded string of username:password, used in auth header of API call + SONATYPE_TOKEN=$(printf "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64) + PUBLISH_NAMESPACE="io.github.lovesh-ap" + # makes a curl request to ossrh-staging-api to upload everything to Central Sonatype + echo "Uploading artifacts from OSSRH-Staging to Central Sonatype..." + # captures response code and body of curl request + 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") + # job fails if we got anything back but a 200 + 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 + - name: Set summary run: | echo "Artifacts from the ref ${{ github.ref }} uploaded to maven. Release type : ${{ inputs.is-release == 'true' && 'Staging' || 'Snapshot' }} " >> $GITHUB_STEP_SUMMARY From 97bebed6fefd0d9b42d021a1cdc72aca269e88c2 Mon Sep 17 00:00:00 2001 From: lovesh-ap Date: Thu, 12 Jun 2025 10:33:31 +0530 Subject: [PATCH 3/9] remove the additional step --- .github/workflows/publish-to-maven.yml | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/.github/workflows/publish-to-maven.yml b/.github/workflows/publish-to-maven.yml index 55c534d76..dc2d715aa 100644 --- a/.github/workflows/publish-to-maven.yml +++ b/.github/workflows/publish-to-maven.yml @@ -128,31 +128,6 @@ jobs: ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} - - name: Upload staged artifacts to Central Sonatype - env: - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - run: | - # token is a b64-encoded string of username:password, used in auth header of API call - SONATYPE_TOKEN=$(printf "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64) - PUBLISH_NAMESPACE="io.github.lovesh-ap" - # makes a curl request to ossrh-staging-api to upload everything to Central Sonatype - echo "Uploading artifacts from OSSRH-Staging to Central Sonatype..." - # captures response code and body of curl request - 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") - # job fails if we got anything back but a 200 - 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 - - name: Set summary run: | echo "Artifacts from the ref ${{ github.ref }} uploaded to maven. Release type : ${{ inputs.is-release == 'true' && 'Staging' || 'Snapshot' }} " >> $GITHUB_STEP_SUMMARY From 0d33b5fc0901f17a7fd95b9ec23409574ea12b10 Mon Sep 17 00:00:00 2001 From: lovesh-ap Date: Thu, 12 Jun 2025 11:07:39 +0530 Subject: [PATCH 4/9] re-correct group id of the artifact --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2382632d1..2ce4efad3 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ allprojects { } } - group = 'io.github.lovesh-ap.agent.java.security' + group = 'com.newrelic.agent.java.security' version = agentVersion + (project.findProperty("release") == "true" ? "" : "-SNAPSHOT") version = version + (project.findProperty("release-suffix") != null ? project.findProperty("release-suffix") : "") idea.module { From 9882087c8f3765ac5a5c301c117d978ec9f6c42c Mon Sep 17 00:00:00 2001 From: lovesh-ap Date: Thu, 12 Jun 2025 11:41:20 +0530 Subject: [PATCH 5/9] add the curl to publish artifacts --- .../workflows/publish-release-to-maven.yml | 2 +- .github/workflows/publish-to-maven.yml | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-release-to-maven.yml b/.github/workflows/publish-release-to-maven.yml index 1aae7301b..24fcf5f20 100644 --- a/.github/workflows/publish-release-to-maven.yml +++ b/.github/workflows/publish-release-to-maven.yml @@ -11,7 +11,7 @@ jobs: secrets: inherit with: apm-repo: 'k2io/newrelic-java-agent' - apm-source-ref: 'csec-dev' + apm-source-ref: 'dev' csec-run-unittest: 'false' csec-run-instrumentation-verify: 'false' is-release: 'true' diff --git a/.github/workflows/publish-to-maven.yml b/.github/workflows/publish-to-maven.yml index dc2d715aa..55c534d76 100644 --- a/.github/workflows/publish-to-maven.yml +++ b/.github/workflows/publish-to-maven.yml @@ -128,6 +128,31 @@ jobs: ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_KEY_PASSWORD }} + - name: Upload staged artifacts to Central Sonatype + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + run: | + # token is a b64-encoded string of username:password, used in auth header of API call + SONATYPE_TOKEN=$(printf "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64) + PUBLISH_NAMESPACE="io.github.lovesh-ap" + # makes a curl request to ossrh-staging-api to upload everything to Central Sonatype + echo "Uploading artifacts from OSSRH-Staging to Central Sonatype..." + # captures response code and body of curl request + 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") + # job fails if we got anything back but a 200 + 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 + - name: Set summary run: | echo "Artifacts from the ref ${{ github.ref }} uploaded to maven. Release type : ${{ inputs.is-release == 'true' && 'Staging' || 'Snapshot' }} " >> $GITHUB_STEP_SUMMARY From 5773da4d624485aa315f632ab015389046a5bf52 Mon Sep 17 00:00:00 2001 From: lovesh-ap Date: Thu, 12 Jun 2025 12:18:58 +0530 Subject: [PATCH 6/9] upgrade gradle action to v3 --- .github/actions/setup-environment/action.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/actions/setup-environment/action.yml b/.github/actions/setup-environment/action.yml index c9971074c..58f3abbab 100644 --- a/.github/actions/setup-environment/action.yml +++ b/.github/actions/setup-environment/action.yml @@ -32,12 +32,12 @@ runs: steps: - name: Set up Javas - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: | + 23 21 - 20 17 11 8 @@ -49,16 +49,16 @@ runs: sed -i -e "s|jdk8=8|jdk8=${JAVA_HOME_8_X64}| s|jdk11=11|jdk11=${JAVA_HOME_11_X64}| s|jdk17=17|jdk17=${JAVA_HOME_17_X64}| - s|jdk20=20|jdk20=${JAVA_HOME_20_X64}| - s|jdk21=21|jdk21=${JAVA_HOME_21_X64}|" gradle.properties.gha + s|jdk21=21|jdk21=${JAVA_HOME_21_X64}| + s|jdk23=23|jdk23=${JAVA_HOME_23_X64}|" gradle.properties.gha cat gradle.properties.gha >> gradle.properties - name: Setup Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 - name: Setup Gradle options shell: bash - run: echo "GRADLE_OPTIONS=-Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=JAVA_HOME_8_X64,JAVA_HOME_11_X64,JAVA_HOME_17_X64,JAVA_HOME_19_X64,JAVA_HOME_20_X64 -Prelease=${{ inputs.is-release }} -Prelease-suffix=${{ inputs.version-suffix }} " >> $GITHUB_ENV + run: echo "GRADLE_OPTIONS=--console=plain --parallel -Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=JAVA_HOME_8_X64,JAVA_HOME_11_X64,JAVA_HOME_17_X64,JAVA_HOME_21_X64,JAVA_HOME_23_X64 -Prelease=${{ inputs.is-release }} -Prelease-suffix=${{ inputs.version-suffix }} " >> $GITHUB_ENV # Restore the maven cache - name: Cache local Maven repository @@ -81,7 +81,8 @@ runs: sed -i -e "s|jdk8=8|jdk8=${JAVA_HOME_8_X64}| s|jdk11=11|jdk11=${JAVA_HOME_11_X64}| s|jdk17=17|jdk17=${JAVA_HOME_17_X64}| - s|jdk20=20|jdk20=${JAVA_HOME_20_X64}|" gradle.properties.gha + s|jdk21=21|jdk21=${JAVA_HOME_21_X64}| + s|jdk23=23|jdk23=${JAVA_HOME_23_X64}|" gradle.properties.gha cat gradle.properties.gha >> gradle.properties cd .. From 786ed33af81e0c47caf9916a1098802126903d66 Mon Sep 17 00:00:00 2001 From: lovesh-ap Date: Thu, 12 Jun 2025 14:20:42 +0530 Subject: [PATCH 7/9] update group id for test and snapshot URL --- build.gradle | 2 +- .../src/main/java/com/nr/builder/publish/PublishConfig.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 2ce4efad3..2382632d1 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ allprojects { } } - group = 'com.newrelic.agent.java.security' + group = 'io.github.lovesh-ap.agent.java.security' version = agentVersion + (project.findProperty("release") == "true" ? "" : "-SNAPSHOT") version = version + (project.findProperty("release-suffix") != null ? project.findProperty("release-suffix") : "") idea.module { diff --git a/buildSrc/src/main/java/com/nr/builder/publish/PublishConfig.java b/buildSrc/src/main/java/com/nr/builder/publish/PublishConfig.java index e208b2ec6..927956e43 100644 --- a/buildSrc/src/main/java/com/nr/builder/publish/PublishConfig.java +++ b/buildSrc/src/main/java/com/nr/builder/publish/PublishConfig.java @@ -60,7 +60,7 @@ private static void configureSigning(Project project, MavenPublication publicati private static void configureRepo(MavenArtifactRepository repo, String projectVersion) { URI releasesRepoUri = URI.create("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"); - URI snapshotsRepoUrl = URI.create("https://ossrh-staging-api.central.sonatype.com/content/repositories/snapshots/"); + URI snapshotsRepoUrl = URI.create("https://central.sonatype.com/repository/maven-snapshots/"); repo.setUrl( projectVersion.endsWith("SNAPSHOT") ? snapshotsRepoUrl From 6c7ccfda807b00b2fcbcf0b15cc633fb9b1a590f Mon Sep 17 00:00:00 2001 From: IshikaDawda Date: Wed, 19 Aug 2026 13:30:47 +0530 Subject: [PATCH 8/9] update Maven source reference and correct group ID in build configuration --- .github/workflows/publish-release-to-maven.yml | 2 +- .github/workflows/publish-to-maven.yml | 2 +- build.gradle | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-release-to-maven.yml b/.github/workflows/publish-release-to-maven.yml index 24fcf5f20..1aae7301b 100644 --- a/.github/workflows/publish-release-to-maven.yml +++ b/.github/workflows/publish-release-to-maven.yml @@ -11,7 +11,7 @@ jobs: secrets: inherit with: apm-repo: 'k2io/newrelic-java-agent' - apm-source-ref: 'dev' + apm-source-ref: 'csec-dev' csec-run-unittest: 'false' csec-run-instrumentation-verify: 'false' is-release: 'true' diff --git a/.github/workflows/publish-to-maven.yml b/.github/workflows/publish-to-maven.yml index 55c534d76..7c2dffe65 100644 --- a/.github/workflows/publish-to-maven.yml +++ b/.github/workflows/publish-to-maven.yml @@ -135,7 +135,7 @@ jobs: run: | # token is a b64-encoded string of username:password, used in auth header of API call SONATYPE_TOKEN=$(printf "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64) - PUBLISH_NAMESPACE="io.github.lovesh-ap" + PUBLISH_NAMESPACE="com.newrelic" # makes a curl request to ossrh-staging-api to upload everything to Central Sonatype echo "Uploading artifacts from OSSRH-Staging to Central Sonatype..." # captures response code and body of curl request diff --git a/build.gradle b/build.gradle index 2382632d1..4832e3955 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ allprojects { } } - group = 'io.github.lovesh-ap.agent.java.security' + group = 'com.newrelic.java.security' version = agentVersion + (project.findProperty("release") == "true" ? "" : "-SNAPSHOT") version = version + (project.findProperty("release-suffix") != null ? project.findProperty("release-suffix") : "") idea.module { From 50fcd026bb3688665d8eb4f9e11dd9e398e09ab7 Mon Sep 17 00:00:00 2001 From: IshikaDawda Date: Wed, 19 Aug 2026 13:35:05 +0530 Subject: [PATCH 9/9] correct group ID for Java security agent in build configuration --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 4832e3955..2ce4efad3 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ allprojects { } } - group = 'com.newrelic.java.security' + group = 'com.newrelic.agent.java.security' version = agentVersion + (project.findProperty("release") == "true" ? "" : "-SNAPSHOT") version = version + (project.findProperty("release-suffix") != null ? project.findProperty("release-suffix") : "") idea.module {