Skip to content

Commit

Permalink
Merge pull request #261 from solarwinds/cc/NH-89068
Browse files Browse the repository at this point in the history
NH-89068: use gradle nexus plugin for publishing SDK
  • Loading branch information
cleverchuk authored Aug 30, 2024
2 parents b9d1ea9 + 52a1f08 commit a99f5c0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
uses: gradle/actions/setup-gradle@v3

- name: Publish
run: ./gradlew publish
run: ./gradlew publish closeAndReleaseSonatypeStagingRepository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The secrets are for publishing the build artifacts to the Maven Central.
Expand Down
8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
* limitations under the License.
*/

group = "com.solarwinds"

buildscript {
repositories {
maven {
Expand All @@ -33,6 +31,12 @@ buildscript {
}
}

plugins{
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}

group = "com.solarwinds"

subprojects {
apply plugin: "java"
apply plugin: "checkstyle"
Expand Down
20 changes: 16 additions & 4 deletions solarwinds-otel-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@

plugins {
id("java")
id("signing")
id("maven-publish")
id("com.github.johnrengelman.shadow")
id("signing")
}

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}")
Expand Down Expand Up @@ -100,9 +103,6 @@ publishing {
repositories {
maven {
name = "OSSRH"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"

url = Boolean.parseBoolean(System.getenv("SNAPSHOT_BUILD")) ? snapshotsRepoUrl : releasesRepoUrl
credentials {
username = System.getenv("SONATYPE_USERNAME")
Expand Down Expand Up @@ -132,3 +132,15 @@ 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)
}
}
}

0 comments on commit a99f5c0

Please sign in to comment.