Skip to content

Update to use new sonatype platform #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.opentracing"
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
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ java {
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
url 'https://central.sonatype.com/repository/maven-snapshots/'
}
}

Expand Down Expand Up @@ -70,8 +70,8 @@ jar {
publishing {
repositories {
maven {
def releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
def snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
def releasesRepoUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/")
def snapshotsRepoUrl = uri("https://central.sonatype.com/repository/maven-snapshots/")
if (version.toString().endsWith("SNAPSHOT")) {
url = snapshotsRepoUrl
} else {
Expand Down
Loading