Skip to content
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
15 changes: 8 additions & 7 deletions .github/actions/setup-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 ..

Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/publish-to-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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="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
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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://central.sonatype.com/repository/maven-snapshots/");
repo.setUrl(
projectVersion.endsWith("SNAPSHOT")
? snapshotsRepoUrl
Expand Down
Loading