Skip to content

Commit d8e6308

Browse files
authored
Merge pull request #80 from newrelic/sonatype-migration
Update to use new sonatype platform
2 parents 2370122 + bd74f6e commit d8e6308

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

.github/workflows/publish_release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,24 @@ jobs:
2323
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
2424
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
2525
run: ./gradlew build publish -Prelease=true
26+
27+
- name: Upload staged artifacts to Central Sonatype
28+
env:
29+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
30+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
31+
run: |
32+
SONATYPE_TOKEN=$(printf "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64)
33+
PUBLISH_NAMESPACE="com.newrelic.opentracing"
34+
echo "Uploading artifacts from OSSRH-Staging to Central Sonatype..."
35+
RESPONSE=$(curl -s -w "%{http_code}" -o response_body.txt -X POST \
36+
-H "Authorization: Bearer $SONATYPE_TOKEN" \
37+
"https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/$PUBLISH_NAMESPACE?publishing_type=user_managed")
38+
if [ "$RESPONSE" -ne 200 ]; then
39+
echo "Failed to upload artifacts to Central Sonatype. Response code: $RESPONSE. Response body: "
40+
cat response_body.txt
41+
echo "Visit https://central.sonatype.com/publishing/deployments for more information."
42+
exit 1
43+
else
44+
echo "Artifacts were uploaded successfully to Central Sonatype."
45+
echo "Visit https://central.sonatype.com/publishing/deployments to view your artifacts."
46+
fi

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ java {
2525
repositories {
2626
mavenCentral()
2727
maven {
28-
url 'https://oss.sonatype.org/content/repositories/snapshots'
28+
url 'https://central.sonatype.com/repository/maven-snapshots/'
2929
}
3030
}
3131

@@ -70,8 +70,8 @@ jar {
7070
publishing {
7171
repositories {
7272
maven {
73-
def releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
74-
def snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
73+
def releasesRepoUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/")
74+
def snapshotsRepoUrl = uri("https://central.sonatype.com/repository/maven-snapshots/")
7575
if (version.toString().endsWith("SNAPSHOT")) {
7676
url = snapshotsRepoUrl
7777
} else {

0 commit comments

Comments
 (0)