Skip to content

Commit 2c6323c

Browse files
authored
Merge pull request #110 from newrelic/migrate-release
Migrate release
2 parents 126f04a + 193fcd6 commit 2c6323c

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

.github/workflows/publish_release.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,32 @@ jobs:
1515
with:
1616
distribution: 'temurin'
1717
java-version: '8'
18-
- name: Build with Gradle
18+
- name: Build with Gradle and stage artifacts
1919
env:
2020
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
2121
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
2222
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
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.logging"
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

gradle/publish.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ configure<PublishingExtension> {
3434
}
3535
repositories {
3636
maven {
37-
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
38-
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
37+
val releasesRepoUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/")
38+
val snapshotsRepoUrl = uri("https://central.sonatype.com/repository/maven-snapshots/")
3939
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
4040

4141
configure<SigningExtension> {

0 commit comments

Comments
 (0)