Migrate to new central publish
This commit is contained in:
parent
0dc3458176
commit
2e1f3876af
@ -2,8 +2,9 @@ plugins {
|
|||||||
`java-gradle-plugin`
|
`java-gradle-plugin`
|
||||||
`kotlin-dsl`
|
`kotlin-dsl`
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
signing
|
// signing
|
||||||
`version-catalog`
|
`version-catalog`
|
||||||
|
alias(libs.plugins.maven.publish)
|
||||||
alias(libs.plugins.jetbrains.changelog)
|
alias(libs.plugins.jetbrains.changelog)
|
||||||
alias(libs.plugins.jetbrains.dokka)
|
alias(libs.plugins.jetbrains.dokka)
|
||||||
alias(libs.plugins.versions)
|
alias(libs.plugins.versions)
|
||||||
@ -111,25 +112,9 @@ val emptySourcesJar by tasks.creating(Jar::class) {
|
|||||||
archiveBaseName.set("empty")
|
archiveBaseName.set("empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
|
||||||
val vcs = "https://github.com/SciProgCentre/gradle-tools"
|
|
||||||
|
|
||||||
// Process each publication we have in this project
|
|
||||||
publications {
|
|
||||||
create<MavenPublication>("catalog") {
|
|
||||||
from(components["versionCatalog"])
|
|
||||||
artifactId = "version-catalog"
|
|
||||||
|
|
||||||
pom {
|
|
||||||
name.set("version-catalog")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
withType<MavenPublication> {
|
|
||||||
// thanks @vladimirsitnikv for the fix
|
|
||||||
artifact(if (name == "catalog") emptySourcesJar else sourcesJar)
|
|
||||||
artifact(if (name == "catalog") emptyJavadocJar else javadocsJar)
|
|
||||||
|
|
||||||
|
mavenPublishing {
|
||||||
|
val vcs = "https://git.sciprog.center/kscience/gradle-tools"
|
||||||
|
|
||||||
pom {
|
pom {
|
||||||
name.set(project.name)
|
name.set(project.name)
|
||||||
@ -158,15 +143,13 @@ publishing {
|
|||||||
tag.set(project.version.toString())
|
tag.set(project.version.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val spaceRepo = "https://maven.sciprog.center/kscience"
|
val spaceRepo = "https://maven.sciprog.center/kscience"
|
||||||
val spcUser: String? = findProperty("publishing.spc.user") as? String
|
val spcUser: String? = findProperty("publishing.spc.user") as? String
|
||||||
val spcToken: String? = findProperty("publishing.spc.token") as? String
|
val spcToken: String? = findProperty("publishing.spc.token") as? String
|
||||||
|
|
||||||
if (spcUser != null && spcToken != null) {
|
if (spcUser != null && spcToken != null) {
|
||||||
repositories.maven {
|
publishing.repositories.maven {
|
||||||
name = "spc"
|
name = "spc"
|
||||||
url = uri(spaceRepo)
|
url = uri(spaceRepo)
|
||||||
|
|
||||||
@ -177,31 +160,15 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val sonatypeUser: String? = project.findProperty("publishing.sonatype.user") as? String
|
val centralUser: String? = project.findProperty("mavenCentralUsername") as? String
|
||||||
val sonatypePassword: String? = project.findProperty("publishing.sonatype.password") as? String
|
val centralPassword: String? = project.findProperty("mavenCentralPassword") as? String
|
||||||
|
|
||||||
if (sonatypeUser != null && sonatypePassword != null) {
|
if (centralUser != null && centralPassword != null) {
|
||||||
val sonatypeRepo: String = if (project.version.toString().contains("dev")) {
|
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.CENTRAL_PORTAL)
|
||||||
"https://oss.sonatype.org/content/repositories/snapshots"
|
signAllPublications()
|
||||||
} else {
|
|
||||||
"https://oss.sonatype.org/service/local/staging/deploy/maven2"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories.maven {
|
configure(com.vanniktech.maven.publish.VersionCatalog())
|
||||||
name = "sonatype"
|
|
||||||
url = uri(sonatypeRepo)
|
|
||||||
|
|
||||||
credentials {
|
|
||||||
username = sonatypeUser
|
|
||||||
password = sonatypePassword
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
signing {
|
|
||||||
//useGpgCmd()
|
|
||||||
sign(publications)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
@ -27,6 +27,7 @@ xmlutil = "0.90.3"
|
|||||||
yamlkt = "0.13.0"
|
yamlkt = "0.13.0"
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
|
maven-publish = { id = "com.vanniktech.maven.publish", version = "0.30.0" }
|
||||||
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||||
compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" }
|
compose-jb = { id = "org.jetbrains.compose", version.ref = "compose" }
|
||||||
jetbrains-changelog = "org.jetbrains.changelog:2.2.1"
|
jetbrains-changelog = "org.jetbrains.changelog:2.2.1"
|
||||||
|
Loading…
Reference in New Issue
Block a user