Skip to content

Commit 1747189

Browse files
authored
[build] update publish plugin (#1091)
`io.codearte.nexus-staging` and `de.marcphilipp.nexus-publish` plugins were deprecated in favor of a single `io.github.gradle-nexus.publish-plugin`. Updated build to use new plugin. Updated release workflow to only close staging repository without releasing. After we verify it works as expected we'll update the GH action to automatically release.
1 parent d1a842e commit 1747189

File tree

4 files changed

+20
-29
lines changed

4 files changed

+20
-29
lines changed

.github/workflows/release-code.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: |
2929
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
3030
echo "New version: ${NEW_VERSION}"
31-
./gradlew :initializeSonatypeStagingRepository publish :closeAndReleaseRepository publishPlugins -Pversion=${NEW_VERSION}
31+
./gradlew publishToSonatype closeSonatypeStagingRepository -Pversion=${NEW_VERSION}
3232
env:
3333
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
3434
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

build.gradle.kts

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import de.marcphilipp.gradle.nexus.NexusPublishExtension
21
import io.gitlab.arturbosch.detekt.detekt
32
import org.jetbrains.dokka.gradle.DokkaTask
43
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
4+
import java.time.Duration
55
import java.time.Instant
66

77
description = "Libraries for running a GraphQL server in Kotlin"
@@ -15,16 +15,15 @@ plugins {
1515
jacoco
1616
signing
1717
`maven-publish`
18-
id("de.marcphilipp.nexus-publish")
19-
id("io.codearte.nexus-staging")
18+
id("io.github.gradle-nexus.publish-plugin")
2019
}
2120

2221
allprojects {
2322
buildscript {
2423
repositories {
25-
mavenLocal()
2624
mavenCentral()
2725
jcenter()
26+
mavenLocal()
2827
}
2928
}
3029

@@ -37,17 +36,6 @@ allprojects {
3736
}
3837
}
3938
}
40-
41-
apply(plugin = "de.marcphilipp.nexus-publish")
42-
43-
configure<NexusPublishExtension> {
44-
repositories {
45-
sonatype {
46-
username.set(System.getenv("SONATYPE_USERNAME"))
47-
password.set(System.getenv("SONATYPE_PASSWORD"))
48-
}
49-
}
50-
}
5139
}
5240

5341
subprojects {
@@ -198,15 +186,21 @@ tasks {
198186
jar {
199187
enabled = false
200188
}
201-
nexusStaging {
202-
username = System.getenv("SONATYPE_USERNAME")
203-
password = System.getenv("SONATYPE_PASSWORD")
204-
packageGroup = rootProject.group.toString()
205-
numberOfRetries = 60
206-
delayBetweenRetriesInMillis = 5000
189+
nexusPublishing {
190+
repositories {
191+
sonatype {
192+
username.set(System.getenv("SONATYPE_USERNAME"))
193+
password.set(System.getenv("SONATYPE_PASSWORD"))
194+
}
195+
}
196+
197+
transitionCheckOptions {
198+
maxRetries.set(60)
199+
delayBetween.set(Duration.ofMillis(5000))
200+
}
207201
}
208202

209-
val resolveIntegrationTestDependencies by register("resolveIntegrationTestDependencies") {
203+
register("resolveIntegrationTestDependencies") {
210204
// our Gradle and Maven integration tests run in separate VMs that will need access to the generated artifacts
211205
// we will need to run them after artifacts are published to local m2 repo
212206
for (graphQLKotlinProject in project.childProjects) {

gradle.properties

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,5 @@ jacocoVersion = 0.8.6
4646
ktlintVersion = 0.41.0
4747
ktlintPluginVersion = 10.0.0
4848
mavenPluginDevelopmentVersion = 0.3.1
49-
nexusPublishPluginVersion = 0.4.0
50-
pluginPublishPluginVersion = 0.11.0
51-
stagingPluginVersion = 0.21.2
49+
nexusPublishPluginVersion = 1.0.0
50+
pluginPublishPluginVersion = 0.13.0

settings.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ pluginManagement {
77
val nexusPublishPluginVersion: String by settings
88
val pluginPublishPluginVersion: String by settings
99
val springBootVersion: String by settings
10-
val stagingPluginVersion: String by settings
1110

1211
plugins {
1312
kotlin("jvm") version kotlinVersion
@@ -16,8 +15,7 @@ pluginManagement {
1615
kotlin("plugin.spring") version kotlinVersion
1716
id("com.gradle.plugin-publish") version pluginPublishPluginVersion
1817
id("de.benediktritter.maven-plugin-development") version mavenPluginDevelopmentVersion
19-
id("de.marcphilipp.nexus-publish") version nexusPublishPluginVersion
20-
id("io.codearte.nexus-staging") version stagingPluginVersion
18+
id("io.github.gradle-nexus.publish-plugin") version nexusPublishPluginVersion
2119
id("io.gitlab.arturbosch.detekt") version detektVersion
2220
id("org.jetbrains.dokka") version dokkaVersion
2321
id("org.jlleitschuh.gradle.ktlint") version ktlintPluginVersion

0 commit comments

Comments
 (0)