From b706e54301b143a0ecf8cf22425b4cd753ba38c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Sousa?= Date: Tue, 23 Jul 2024 23:34:03 +0100 Subject: [PATCH] Update configuration for publishing releases --- build.gradle | 37 +++++++++++++++++++++++++++++++++++++ gradle/publish.gradle | 27 --------------------------- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/build.gradle b/build.gradle index 58f37266..3b81c755 100644 --- a/build.gradle +++ b/build.gradle @@ -13,6 +13,7 @@ plugins { alias libs.plugins.kotlin.android apply false alias libs.plugins.kotlin.kover apply false alias libs.plugins.androidx.navigation.safeargs apply false + id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' id 'org.jetbrains.dokka' version '1.9.20' id 'org.jetbrains.kotlinx.binary-compatibility-validator' version "0.14.0" } @@ -21,3 +22,39 @@ apiValidation { ignoredProjects += ["sample", "dpadrecyclerview-test-fixtures"] ignoredClasses += "com.rubensousa.dpadrecyclerview.BuildConfig" } + +nexusPublishing { + repositories { + sonatype { + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) + stagingProfileId = getSonatypeStagingId() + username = getSonatypeUsername() + password = getSonatypePassword() + } + } +} + +String getSonatypeStagingId() { + if (hasProperty("ossrhStagingProfileId")) { + return ossrhStagingProfileId + } else { + return "" + } +} + +String getSonatypeUsername() { + if (hasProperty("ossrhUsername")) { + return ossrhUsername + } else { + return "" + } +} + +String getSonatypePassword() { + if (hasProperty("ossrhPassword")) { + return ossrhPassword + } else { + return "" + } +} \ No newline at end of file diff --git a/gradle/publish.gradle b/gradle/publish.gradle index ffa54d32..65151767 100644 --- a/gradle/publish.gradle +++ b/gradle/publish.gradle @@ -92,22 +92,6 @@ String getSecretKeyRingFilePath() { } } -String getSonatypeUsername() { - if (hasProperty("ossrhUsername")) { - return ossrhUsername - } else { - return "" - } -} - -String getSonatypePassword() { - if (hasProperty("ossrhPassword")) { - return ossrhPassword - } else { - return "" - } -} - afterEvaluate { project -> publishing { publications { @@ -119,17 +103,6 @@ afterEvaluate { project -> configurePom(pom) } } - repositories { - maven { - name = "sonatype" - url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" - - credentials { - username getSonatypeUsername() - password getSonatypePassword() - } - } - } } }