Skip to content

Commit da97d35

Browse files
committed
switch to new sonatype deployment (central)
1 parent d4bb033 commit da97d35

File tree

2 files changed

+38
-44
lines changed

2 files changed

+38
-44
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ jobs:
3939
- name: Publish package
4040
run: ./gradlew dokkaHtml publish
4141
env:
42-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
43-
OSSRH_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
42+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
43+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
44+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SCRAYOSNET_GPG_MEMORYKEY }}
45+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SCRAYOSNET_GPG_PASSWORD }}
4446
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4547

4648
- name: Setup Pages

build.gradle.kts

Lines changed: 34 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@file:Suppress("UnstableApiUsage")
22

33
import com.google.protobuf.gradle.id
4-
import org.gradle.internal.impldep.org.bouncycastle.cms.RecipientId.password
4+
import com.vanniktech.maven.publish.SonatypeHost
55
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
66

77
// define the gav coordinates of this project
@@ -17,7 +17,7 @@ plugins {
1717
alias(libs.plugins.kotlin)
1818
alias(libs.plugins.dokka)
1919
alias(libs.plugins.kover)
20-
alias(libs.plugins.nexusPublish)
20+
id("com.vanniktech.maven.publish") version "0.28.0"
2121
alias(libs.plugins.protobuf)
2222
alias(libs.plugins.sonarqube)
2323
alias(libs.plugins.ktlint)
@@ -51,12 +51,6 @@ dependencies {
5151
dokkaHtmlPlugin(libs.dokka.html)
5252
}
5353

54-
// configure the java extension
55-
java {
56-
// also generate javadoc and sources
57-
withSourcesJar()
58-
}
59-
6054
// configure the kotlin extension
6155
kotlin {
6256
// set the toolchain version that is required to build this project
@@ -114,33 +108,40 @@ testing {
114108
}
115109
}
116110

117-
// configure dokka task for html output
118-
val dokkaHtmlJar = tasks.register<Jar>("dokkaHtmlJar") {
119-
description = "Generates the HTML documentation for this project."
120-
group = JavaBasePlugin.DOCUMENTATION_GROUP
121-
dependsOn(tasks.dokkaHtml)
122-
from(tasks.dokkaHtml.flatMap { it.outputDirectory })
123-
archiveClassifier.set("html-docs")
124-
}
125-
126-
// configure dokka task for javadoc output
127-
val dokkaJavadocJar = tasks.register<Jar>("dokkaJavadocJar") {
128-
description = "Generates the Javadoc documentation for this project."
129-
group = JavaBasePlugin.DOCUMENTATION_GROUP
130-
dependsOn(tasks.dokkaJavadoc)
131-
from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
132-
archiveClassifier.set("javadoc")
133-
}
134-
135-
nexusPublishing {
136-
repositories {
137-
sonatype {
138-
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
139-
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
140-
username = System.getenv("OSSRH_USERNAME")
141-
password = System.getenv("OSSRH_PASSWORD")
111+
// configure publishing for the sonatype portal
112+
mavenPublishing {
113+
// add the central portal of Sonatype
114+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
115+
116+
// configure mandatory metadata for Maven Central
117+
pom {
118+
name.set("xenos-client (Kotlin)")
119+
description.set("A gRPC client/binding for the communication with xenos.")
120+
inceptionYear.set("2024")
121+
url.set("https://github.com/scrayosnet/xenos-client-kotlin/")
122+
licenses {
123+
license {
124+
name.set("MIT License")
125+
url.set("https://opensource.org/license/mit")
126+
distribution.set("repo")
127+
}
128+
}
129+
developers {
130+
developer {
131+
id.set("scrayos")
132+
name.set("Joshua Dean Küpper")
133+
url.set("https://github.com/scrayos/")
134+
}
135+
}
136+
scm {
137+
url.set("https://github.com/scrayosnet/xenos-client-kotlin/")
138+
connection.set("scm:git:git://github.com/scrayosnet/xenos-client-kotlin.git")
139+
developerConnection.set("scm:git:ssh://[email protected]/scrayosnet/xenos-client-kotlin.git")
142140
}
143141
}
142+
143+
// sign all exported publications
144+
signAllPublications()
144145
}
145146

146147
// configure the publishing in the maven repository
@@ -156,15 +157,6 @@ publishing {
156157
}
157158
}
158159
}
159-
160-
// define the java components as publications for the repository
161-
publications {
162-
create<MavenPublication>("maven") {
163-
from(components["java"])
164-
artifact(dokkaJavadocJar)
165-
artifact(dokkaHtmlJar)
166-
}
167-
}
168160
}
169161

170162
// configure ktlint

0 commit comments

Comments
 (0)