Skip to content

Commit 4583a14

Browse files
ci: migrate publishing to maven central (#106686)
1 parent 383b3d3 commit 4583a14

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup
2121
uses: IntershopCommunicationsAG/.github/actions/gradle-plugin-setup@v2
2222
- name: Release
23-
uses: IntershopCommunicationsAG/.github/actions/gradle-plugin-release@v2
23+
uses: IntershopCommunicationsAG/.github/actions/gradle-plugin-release@v3
2424
with:
2525
signing-file: ${{ secrets.SIGNINGFILE }}
2626
signing-key-id: ${{ secrets.SIGNINGKEYID }}

build.gradle.kts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import org.asciidoctor.gradle.jvm.AsciidoctorTask
2+
import io.gitee.pkmer.enums.PublishingType
23

34
/*
45
* Copyright 2022 Intershop Communications AG.
@@ -43,6 +44,8 @@ plugins {
4344
id("com.gradle.plugin-publish") version "1.3.0"
4445

4546
id("com.dorongold.task-tree") version "4.0.0"
47+
48+
id("io.gitee.pkmer.pkmerboot-central-publisher") version "1.1.1"
4649
}
4750

4851
// release configuration
@@ -211,6 +214,8 @@ tasks {
211214
}
212215
}
213216

217+
val stagingRepoDir = project.layout.buildDirectory.dir("stagingRepo")
218+
214219
publishing {
215220
publications {
216221
create("intershopMvn", MavenPublication::class.java) {
@@ -224,7 +229,8 @@ publishing {
224229
artifact(File(buildDir, "docs/asciidoc/docbook/README.xml")) {
225230
classifier = "docbook"
226231
}
227-
232+
}
233+
withType<MavenPublication>().configureEach {
228234
pom {
229235
name.set(project.name)
230236
description.set(project.description)
@@ -257,17 +263,29 @@ publishing {
257263
}
258264
repositories {
259265
maven {
260-
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
261-
val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
262-
url = uri(if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl)
263-
credentials {
264-
username = sonatypeUsername
265-
password = sonatypePassword
266-
}
266+
name = "LOCAL"
267+
url = stagingRepoDir.get().asFile.toURI()
267268
}
268269
}
269270
}
270271

272+
pkmerBoot {
273+
sonatypeMavenCentral{
274+
// the same with publishing.repositories.maven.url in the configuration.
275+
stagingRepository = stagingRepoDir
276+
277+
/**
278+
* get username and password from
279+
* <a href="https://central.sonatype.com/account"> central sonatype account</a>
280+
*/
281+
username = sonatypeUsername
282+
password = sonatypePassword
283+
284+
// Optional the publishingType default value is PublishingType.AUTOMATIC
285+
publishingType = PublishingType.USER_MANAGED
286+
}
287+
}
288+
271289
signing {
272290
sign(publishing.publications["intershopMvn"])
273291
}

0 commit comments

Comments
 (0)