@@ -7,6 +7,9 @@ plugins {
77 kotlin(" plugin.serialization" ) version " 2.3.10" apply false
88 id(" org.jetbrains.dokka" ) version " 2.1.0"
99 id(" org.jetbrains.dokka-javadoc" ) version " 2.1.0"
10+ id(" signing" )
11+ id(" maven-publish" )
12+ id(" io.github.gradle-nexus.publish-plugin" ) version " 2.0.0"
1013}
1114
1215subprojects {
@@ -20,6 +23,8 @@ subprojects {
2023 apply (plugin = kotlin(" plugin.serialization" ))
2124 apply (plugin = " org.jetbrains.dokka" )
2225 apply (plugin = " org.jetbrains.dokka-javadoc" )
26+ apply (plugin = " signing" )
27+ apply (plugin = " maven-publish" )
2328
2429 kotlin {
2530 compilerOptions.allWarningsAsErrors = true
@@ -41,6 +46,80 @@ subprojects {
4146 }
4247 }
4348 }
49+
50+ java {
51+ withSourcesJar()
52+ withJavadocJar()
53+ }
54+
55+ tasks.named<Jar >(" javadocJar" ) {
56+ from(tasks.named(" dokkaGenerate" ))
57+ }
58+
59+ configure<PublishingExtension > {
60+ publications {
61+ create<MavenPublication >(" maven" ) {
62+ from(components[" java" ])
63+
64+ pom {
65+ name.set(project.name)
66+ description.set(" TypedRest helps you build type-safe, fluent-style REST API clients." )
67+ url.set(" https://typedrest.net/" )
68+
69+ licenses {
70+ license {
71+ name.set(" MIT License" )
72+ url.set(" https://opensource.org/licenses/MIT" )
73+ }
74+ }
75+
76+ developers {
77+ developer {
78+ name.set(" Bastian Eicher" )
79+ url.set(" https://github.com/bastianeicher" )
80+ }
81+ }
82+
83+ scm {
84+ connection.set(" scm:git:https://github.com/TypedRest/TypedRest-Java.git" )
85+ developerConnection.set(" scm:git:git@github.com:TypedRest/TypedRest-Java.git" )
86+ url.set(" https://github.com/TypedRest/TypedRest-Java" )
87+ }
88+ }
89+ }
90+ }
91+
92+ repositories {
93+ maven {
94+ name = " GitHub"
95+ url = uri(" https://maven.pkg.github.com/TypedRest/TypedRest-Java" )
96+ credentials {
97+ username = System .getenv(" GITHUB_ACTOR" )
98+ password = System .getenv(" GITHUB_TOKEN" )
99+ }
100+ }
101+ }
102+ }
103+
104+ configure<SigningExtension > {
105+ val signingKey = System .getenv(" SIGNING_KEY" )
106+ val signingPassword = System .getenv(" SIGNING_PASSWORD" )
107+ if (signingKey != null && signingPassword != null ) {
108+ useInMemoryPgpKeys(signingKey, signingPassword)
109+ sign(the<PublishingExtension >().publications[" maven" ])
110+ }
111+ }
112+ }
113+
114+ nexusPublishing {
115+ repositories {
116+ sonatype {
117+ nexusUrl.set(uri(" https://s01.oss.sonatype.org/service/local/" ))
118+ snapshotRepositoryUrl.set(uri(" https://s01.oss.sonatype.org/content/repositories/snapshots/" ))
119+ username.set(System .getenv(" SONATYPE_USERNAME" ))
120+ password.set(System .getenv(" SONATYPE_PASSWORD" ))
121+ }
122+ }
44123}
45124
46125dependencies {
0 commit comments