Skip to content

Commit f7de3c9

Browse files
committed
update to new publish plugin
1 parent 255a24d commit f7de3c9

File tree

5 files changed

+30
-38
lines changed

5 files changed

+30
-38
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ jobs:
106106
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}
107107
PUBLISH_KEY: ${{ secrets.PUBLISH_KEY }}
108108
run: |
109-
./gradlew publishToMavenCentral --stacktrace
109+
./gradlew publishToMavenCentral -Psnapshot --stacktrace
110110
111111
sonar:
112112
needs: [test]

build.gradle.kts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
plugins {
22
base
33
alias(libs.plugins.jacoco)
4-
id("io.openapiprocessor.build.plugin.publish-central")
4+
id("io.openapiprocessor.build.plugin.publish")
55
}
66

7+
group = "io.openapiprocessor"
8+
version = libs.versions.openapiparser.get()
9+
println("version: $version")
10+
711
repositories {
812
mavenCentral()
913
}
@@ -13,12 +17,19 @@ tasks.named("build") {
1317
dependsOn ("jacocoLogAggregatedCoverage")
1418
}
1519

16-
group = "io.openapiprocessor"
17-
version = libs.versions.openapiparser.get()
18-
println("version: $version")
19-
20-
publishProcessor {
20+
publishingCentral {
2121
stagingDir = layout.buildDirectory.dir("staging")
2222
deploymentDir = layout.buildDirectory.dir("deployment")
23-
publish = false
23+
deploymentName = "parser"
24+
}
25+
26+
afterEvaluate {
27+
if (hasProperty("snapshot")) {
28+
tasks.named("publishAllReleasesToMavenCentral") {
29+
enabled = version.toString().endsWith("SNAPSHOT")
30+
if (!enabled) {
31+
logger.warn("skipping publishing because version is not a snapshot.")
32+
}
33+
}
34+
}
2435
}

buildSrc/settings.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ pluginManagement {
44
repositories {
55
gradlePluginPortal()
66
mavenCentral()
7+
maven {
8+
url = uri("https://central.sonatype.com/repository/maven-snapshots")
9+
mavenContent {
10+
snapshotsOnly()
11+
}
12+
}
713
}
814
}
915

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,21 @@
1-
import io.openapiprocessor.build.core.dsl.initFrom
2-
import io.openapiprocessor.build.core.dsl.initSignKey
3-
import io.openapiprocessor.build.core.dsl.sonatype
4-
import io.openapiprocessor.build.core.getPomProperties
5-
import org.gradle.accessors.dm.LibrariesForLibs
6-
71
plugins {
82
`maven-publish`
9-
signing
10-
id("io.openapiprocessor.build.plugin.publish-base")
3+
id("io.openapiprocessor.build.plugin.publish")
114
}
125

13-
// central plugin setup must run in the context of the applying project
14-
plugins.apply("io.openapiprocessor.build.plugin.publish-central")
15-
16-
// see buildSrc/build.gradle.kts
17-
val libs = the<LibrariesForLibs>()
18-
196
val componentName = if (isPlatform()) { "javaPlatform" } else { "java" }
207

218
publishing {
229
publications {
2310
create<MavenPublication>("openapiparser") {
2411
from(components[componentName])
25-
26-
pom {
27-
pom.initFrom(getPomProperties(project))
28-
}
2912
}
3013
}
31-
32-
repositories {
33-
sonatype(project)
34-
}
35-
}
36-
37-
signing {
38-
initSignKey()
39-
sign(publishing.publications["openapiparser"])
4014
}
4115

42-
publishProcessor {
16+
publishingCentral {
17+
publication = "openapiparser"
4318
stagingDir = rootProject.layout.buildDirectory.dir("staging")
4419
deploymentDir = rootProject.layout.buildDirectory.dir("deployment")
45-
publish = false
20+
deploymentName = "parser"
4621
}

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ openapiparser = "2025.4-SNAPSHOT"
33

44
build-jdk = "11"
55
test-jdk = "17"
6-
build-plugins = "2025.4-SNAPSHOT"
6+
build-plugins = "2025.7-SNAPSHOT"
77

88
# using the embedded kotlin version of gradle to avoid mixed versions
99
kotlin = "2.2.10"

0 commit comments

Comments
 (0)