Migrate to com.vanniktech.maven.publish publish plugin, update gradle, publish to maven central.
Some checks are pending
Gradle CI / build (push) Waiting to run

This commit is contained in:
2025-04-06 15:12:02 +02:00
parent ab5689133f
commit 6f37c879c2
4 changed files with 55 additions and 87 deletions

View File

@@ -1,12 +1,13 @@
@file:OptIn(ExperimentalWasmDsl::class)
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
plugins {
kotlin("multiplatform") version "2.1.10"
`maven-publish`
signing
id("org.jetbrains.dokka") version "1.5.31"
id("com.vanniktech.maven.publish") version "0.31.0"
}
group = "nl.astraeus"
@@ -14,6 +15,10 @@ version = "1.2.5"
repositories {
mavenCentral()
maven {
name = "Sonatype Releases"
url = uri("https://central.sonatype.com/api/v1/publisher/deployments/download/")
}
}
/*
@@ -76,67 +81,14 @@ kotlin {
}
}
extra["PUBLISH_GROUP_ID"] = group
extra["PUBLISH_VERSION"] = version
extra["PUBLISH_ARTIFACT_ID"] = name
// Stub secrets to let the project sync and build without the publication values set up
val signingKeyId: String? by project
val signingPassword: String? by project
val signingSecretKeyRingFile: String? by project
val ossrhUsername: String? by project
val ossrhPassword: String? by project
extra["signing.keyId"] = signingKeyId
extra["signing.password"] = signingPassword
extra["signing.secretKeyRingFile"] = signingSecretKeyRingFile
extra["ossrhUsername"] = ossrhUsername
extra["ossrhPassword"] = ossrhPassword
val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}
publishing {
repositories {
mavenLocal()
maven {
name = "releases"
// change to point to your repo, e.g. http://my.org/repo
setUrl("https://reposilite.astraeus.nl/releases")
credentials {
val reposiliteUsername: String? by project
val reposilitePassword: String? by project
username = reposiliteUsername
password = reposilitePassword
}
}
maven {
name = "snapshots"
// change to point to your repo, e.g. http://my.org/repo
setUrl("https://reposilite.astraeus.nl/snapshots")
credentials {
val reposiliteUsername: String? by project
val reposilitePassword: String? by project
username = reposiliteUsername
password = reposilitePassword
}
}
maven {
name = "sonatype"
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2")
credentials {
username = ossrhUsername
password = ossrhPassword
}
}
maven {
name = "gitea"
setUrl("https://gitea.astraeus.nl/api/packages/rnentjes/maven")
credentials() {
credentials {
val giteaUsername: String? by project
val giteaPassword: String? by project
@@ -145,36 +97,6 @@ publishing {
}
}
}
// Configure all publications
publications.withType<MavenPublication> {
// Stub javadoc.jar artifact
artifact(javadocJar.get())
// Provide artifacts information requited by Maven Central
pom {
name.set("kotlin-komponent")
description.set("Kotlin komponent")
url.set("https://github.com/rnentjes/komponent")
licenses {
license {
name.set("MIT")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
id.set("rnentjes")
name.set("Rien Nentjes")
email.set("info@nentjes.com")
}
}
scm {
url.set("https://github.com/rnentjes/komponent")
}
}
}
}
tasks.withType<AbstractPublishToMaven> {
@@ -185,6 +107,37 @@ signing {
sign(publishing.publications)
}
mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
signAllPublications()
coordinates(group.toString(), name.toString(), version.toString())
pom {
name = "kotlin-komponent"
description = "Kotlin komponent"
inceptionYear = "2017"
url = "https://github.com/rnentjes/komponent"
licenses {
license {
name = "MIT"
url = "https://opensource.org/licenses/MIT"
}
}
developers {
developer {
id = "rnentjes"
name = "Rien Nentjes"
email = "info@nentjes.com"
}
}
scm {
url = "https://github.com/rnentjes/komponent"
}
}
}
tasks.withType<PublishToMavenRepository> {
dependsOn(tasks.withType<Sign>())
}

View File

@@ -1,5 +1,5 @@
#Wed Mar 04 13:29:12 CET 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists

View File

@@ -8,6 +8,6 @@ See the komp-todo repository for a basic example here: [komp-todo](https://githu
For a more complete example take a look at the simple-password-manager repository: [simple-password-manager](https://github.com/rnentjes/simple-password-manager)
Available on maven central: "nl.astraeus:kotlin-komponent-js:1.2.1"
Available on maven central: "nl.astraeus:kotlin-komponent-js:1.2.5"
Some getting started documentation can be found [here](docs/getting-started.md)

View File

@@ -1,2 +1,17 @@
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
}
}
rootProject.name = "kotlin-komponent"