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() - } - } - } } }