Skip to content

Commit

Permalink
Update configuration for publishing releases
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensousa committed Jul 23, 2024
1 parent 6f38609 commit b706e54
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 27 deletions.
37 changes: 37 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand All @@ -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 ""
}
}
27 changes: 0 additions & 27 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
}
}
}
}
}

Expand Down

0 comments on commit b706e54

Please sign in to comment.