Skip to content

Commit

Permalink
Update the Sonatype publishing setup
Browse files Browse the repository at this point in the history
Migrate to https://github.com/gradle-nexus/publish-plugin to reduce flakiness
  • Loading branch information
ogolberg authored Mar 8, 2023
1 parent ee28de2 commit 9134245
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 31 deletions.
5 changes: 1 addition & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ jobs:
- read_cache
- run:
name: Publish release
command: "./gradlew publish --stacktrace"
- run:
name: Promote release
command: "./gradlew closeAndReleaseRepository --stacktrace"
command: "./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --stacktrace"

workflows:
version: 2.1
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ repositories {

dependencies {
implementation(libs.kotlin.gradle)
implementation(libs.nexus.staging)
implementation(libs.nexus.publish)
implementation(libs.spotless)
}
16 changes: 8 additions & 8 deletions buildSrc/src/main/kotlin/nexus-staging-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import org.gradle.kotlin.dsl.configure

plugins {
id("io.codearte.nexus-staging")
id("io.github.gradle-nexus.publish-plugin")
}

if (isRelease()) {
nexusStaging {
username = Remote.username
password = Remote.password
packageGroup = "com.toasttab"
numberOfRetries = 50
nexusPublishing {
repositories {
sonatype {
username.set(Remote.username)
password.set(Remote.password)
}
}
}
}
15 changes: 0 additions & 15 deletions buildSrc/src/main/kotlin/publishing-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,6 @@ publishing {
}
}
}

if (isRelease()) {
repositories {
maven {
name = "remote"
setUrl(Remote.url)
credentials {
username = Remote.username
password = Remote.password
}
}
}
}
}

@Suppress("IMPLICIT_CAST_TO_ANY")
Expand All @@ -85,6 +72,4 @@ if (isRelease() && Pgp.key != null) {
sign(this)
}
}
} else {
tasks.register("closeAndReleaseRepository")
}
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ junit = "5.8.2"
ksp = "1.7.21-1.0.8"
autoservice-ksp = "1.0.0"

nexus = "0.30.0"
nexus = "1.3.0"

# test
mockk = "1.9.2"
Expand All @@ -31,7 +31,7 @@ ksp-api = { module = "com.google.devtools.ksp:symbol-processing-api", version.re
autoservice-ksp = { module = "dev.zacsweers.autoservice:auto-service-ksp", version.ref = "autoservice-ksp"}

# plugins
nexus-staging = { module = "io.codearte.gradle.nexus:gradle-nexus-staging-plugin", version.ref = "nexus" }
nexus-publish = { module = "io.github.gradle-nexus:publish-plugin", version.ref = "nexus" }
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "6.11.0" }

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 9134245

Please sign in to comment.