@@ -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
0 commit comments