-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate Publishing to vanniktech plugin
- Loading branch information
1 parent
892a770
commit f57882f
Showing
5 changed files
with
54 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,50 @@ | ||
import java.lang.System.getenv | ||
import java.util.Base64 | ||
|
||
plugins { | ||
`maven-publish` | ||
signing | ||
// For some reason, Gradle does not generate an accessor for this | ||
id("com.vanniktech.maven.publish.base") | ||
} | ||
|
||
fun MavenPublication.registerDokkaJar() = | ||
tasks.register<Jar>("${name}DokkaJar") { | ||
archiveClassifier = "javadoc" | ||
destinationDirectory = destinationDirectory.get().dir(name) | ||
from(tasks.named("dokkaHtml")) | ||
} | ||
|
||
publishing { | ||
publications { | ||
withType<MavenPublication>().configureEach { | ||
if (project.name != "bom") artifact(registerDokkaJar()) | ||
|
||
groupId = Library.group | ||
artifactId = "kord-$artifactId" | ||
version = libraryVersion | ||
group = Library.group | ||
version = libraryVersion | ||
|
||
pom { | ||
name = Library.name | ||
description = Library.description | ||
url = Library.projectUrl | ||
mavenPublishing { | ||
coordinates(Library.group, "kord-${project.name}", libraryVersion) | ||
// This sets up OSSRH snapshots + maven central | ||
publishToMavenCentral(automaticRelease = true) | ||
signAllPublications() | ||
|
||
organization { | ||
name = "Kord" | ||
url = "https://github.com/kordlib" | ||
} | ||
pom { | ||
name = Library.name | ||
description = Library.description | ||
url = Library.projectUrl | ||
|
||
developers { | ||
developer { | ||
name = "The Kord Team" | ||
} | ||
} | ||
|
||
issueManagement { | ||
system = "GitHub" | ||
url = "https://github.com/kordlib/kord/issues" | ||
} | ||
|
||
licenses { | ||
license { | ||
name = "MIT" | ||
url = "https://opensource.org/licenses/MIT" | ||
} | ||
} | ||
organization { | ||
name = "Kord" | ||
url = "https://github.com/kordlib" | ||
} | ||
|
||
scm { | ||
connection = "scm:git:ssh://github.com/kordlib/kord.git" | ||
developerConnection = "scm:git:ssh://git@github.com:kordlib/kord.git" | ||
url = Library.projectUrl | ||
} | ||
developers { | ||
developer { | ||
name = "The Kord Team" | ||
} | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
url = uri(if (isRelease) Repo.releasesUrl else Repo.snapshotsUrl) | ||
issueManagement { | ||
system = "GitHub" | ||
url = "https://github.com/kordlib/kord/issues" | ||
} | ||
|
||
credentials { | ||
username = getenv("NEXUS_USER") | ||
password = getenv("NEXUS_PASSWORD") | ||
licenses { | ||
license { | ||
name = "MIT" | ||
url = "https://opensource.org/licenses/MIT" | ||
distribution = "https://github.com/kordlib/kord/blob/LICENSE" | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
val secretKey = getenv("SIGNING_KEY")?.let { String(Base64.getDecoder().decode(it)) } | ||
val password = getenv("SIGNING_PASSWORD") | ||
useInMemoryPgpKeys(secretKey, password) | ||
sign(publishing.publications) | ||
scm { | ||
connection = "scm:git:ssh://github.com/kordlib/kord.git" | ||
developerConnection = "scm:git:ssh://git@github.com:kordlib/kord.git" | ||
url = Library.projectUrl | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters