diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 24844c89..a8ee42fa 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -587,4 +587,4 @@ jobs: echo "AGENT_VERSION=${{ steps.set_version.outputs.version }}.$GIT_HASH" >> $GITHUB_ENV - name: Publish - run: ./gradlew publish \ No newline at end of file + run: ./gradlew publishToSonatype \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b86ff283..566779dc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,7 +50,7 @@ jobs: uses: gradle/actions/setup-gradle@v3 - name: Publish - run: ./gradlew publish + run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # The secrets are for publishing the build artifacts to the Maven Central. diff --git a/build.gradle b/build.gradle index d80d938b..1958a10e 100644 --- a/build.gradle +++ b/build.gradle @@ -35,7 +35,9 @@ plugins{ id("io.github.gradle-nexus.publish-plugin") version "2.0.0" } -group = "com.solarwinds" +def swoVersion = property('swo.agent.version') +group = "io.github.appoptics" +version = Boolean.parseBoolean(System.getenv("SNAPSHOT_BUILD")) ? "$swoVersion-SNAPSHOT" : swoVersion subprojects { apply plugin: "java" @@ -49,7 +51,7 @@ subprojects { bytebuddy : "1.12.10", guava : "30.1-jre", joboe : "10.0.12", - agent : "2.8.0", // the custom distro agent version + agent : swoVersion, // the custom distro agent version autoservice : "1.0.1", caffeine : "2.9.3", json : "20231013", @@ -138,3 +140,15 @@ subprojects { disableAutoTargetJvm() } } + +nexusPublishing { + repositories { + sonatype { + password = System.getenv("SONATYPE_TOKEN") + username = System.getenv("SONATYPE_USERNAME") + + nexusUrl = uri("https://s01.oss.sonatype.org/service/local/") + snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") + } + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 23c6e9d1..c13eff28 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,3 +21,4 @@ systemProp.org.gradle.internal.repository.initial.backoff=500 # Project properties provides a central place for shared property among subprojects otel.agent.version=2.8.0 otel.sdk.version=1.42.1 +swo.agent.version=2.8.0 diff --git a/solarwinds-otel-sdk/build.gradle b/solarwinds-otel-sdk/build.gradle index 6d080949..538565af 100644 --- a/solarwinds-otel-sdk/build.gradle +++ b/solarwinds-otel-sdk/build.gradle @@ -25,9 +25,6 @@ apply from: "$rootDir/gradle/shadow.gradle" project.archivesBaseName = 'solarwinds-otel-sdk' def relocatePackages = ext.relocatePackages -def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/" -def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" - dependencies { compileOnly project(":bootstrap") compileOnly("io.opentelemetry:opentelemetry-sdk:${versions.opentelemetry}") @@ -87,26 +84,15 @@ publishing { groupId = 'io.github.appoptics' artifactId = "${archivesBaseName}" - def sdkVersion = System.getenv("AGENT_VERSION") ?: "2.6.0" - version = Boolean.parseBoolean(System.getenv("SNAPSHOT_BUILD")) ? "$sdkVersion-SNAPSHOT" : "${versions.agent}" + + def snapshotVersion = System.getenv("AGENT_VERSION") + version = Boolean.parseBoolean(System.getenv("SNAPSHOT_BUILD")) ? "${snapshotVersion}-SNAPSHOT" : "${versions.agent}" from components.java artifact sourcesJar artifact javadocJar } } - publishToMavenLocal - } - - repositories { - maven { - name = "OSSRH" - url = Boolean.parseBoolean(System.getenv("SNAPSHOT_BUILD")) ? snapshotsRepoUrl : releasesRepoUrl - credentials { - username = System.getenv("SONATYPE_USERNAME") - password = System.getenv("SONATYPE_TOKEN") - } - } } } @@ -129,16 +115,4 @@ test { compileJava { options.release.set(8) -} - -nexusPublishing { - repositories { - sonatype { - password = System.getenv("SONATYPE_TOKEN") - username = System.getenv("SONATYPE_USERNAME") - - nexusUrl = uri(releasesRepoUrl) - snapshotRepositoryUrl = uri(snapshotsRepoUrl) - } - } } \ No newline at end of file