Skip to content

Commit 73093be

Browse files
authored
Add publish-plugin (#43)
* Add publish-plugin * drift
1 parent c829b68 commit 73093be

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

build.gradle.kts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,25 @@ plugins {
2222

2323
id("com.diffplug.spotless")
2424
id("com.github.jk1.dependency-license-report")
25+
id("io.github.gradle-nexus.publish-plugin")
2526
id("nebula.release")
2627
}
2728

2829
release {
2930
defaultVersionStrategy = Strategies.getSNAPSHOT()
3031
}
3132

33+
nexusPublishing {
34+
repositories {
35+
sonatype {
36+
nexusUrl.set(uri("https://aws.oss.sonatype.org/service/local/staging/deploy/maven2"))
37+
snapshotRepositoryUrl.set(uri("https://aws.oss.sonatype.org/content/repositories/snapshots/"))
38+
username.set(System.getenv("PUBLISH_USERNAME"))
39+
password.set(System.getenv("PUBLISH_PASSWORD"))
40+
}
41+
}
42+
}
43+
3244
val releaseTask = tasks.named("release")
3345
val postReleaseTask = tasks.named("release")
3446

@@ -126,10 +138,12 @@ allprojects {
126138
plugins.withId("maven-publish") {
127139
plugins.apply("signing")
128140

129-
val publishTask = tasks.named("publish")
141+
afterEvaluate {
142+
val publishTask = tasks.named("publishToSonatype")
130143

131-
postReleaseTask.configure {
132-
dependsOn(publishTask)
144+
postReleaseTask.configure {
145+
dependsOn(publishTask)
146+
}
133147
}
134148

135149
configure<PublishingExtension> {
@@ -187,22 +201,6 @@ allprojects {
187201
}
188202
}
189203
}
190-
191-
val isSnapshot = version.toString().endsWith("SNAPSHOT")
192-
193-
repositories {
194-
maven {
195-
name = "Sonatype"
196-
url = uri(
197-
if (isSnapshot) "https://aws.oss.sonatype.org/content/repositories/snapshots/"
198-
else "https://aws.oss.sonatype.org/service/local/staging/deploy/maven2"
199-
)
200-
credentials {
201-
username = System.getenv("PUBLISH_USERNAME")
202-
password = System.getenv("PUBLISH_PASSWORD")
203-
}
204-
}
205-
}
206204
}
207205

208206
tasks.withType<Sign>().configureEach {

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pluginManagement {
2020
id("com.github.jk1.dependency-license-report") version "1.16"
2121
id("com.github.johnrengelman.shadow") version "6.1.0"
2222
id("com.google.cloud.tools.jib") version "2.7.0"
23+
id("io.github.gradle-nexus.publish-plugin") version "1.0.0"
2324
id("nebula.release") version "15.3.0"
2425
id("org.springframework.boot") version "2.4.0"
2526
}

0 commit comments

Comments
 (0)