@@ -7,9 +7,20 @@ plugins {
77
88allprojects {
99 group = " com.godaddy.ans"
10- version = " 0.1.0"
10+ version = " 0.1.0" // x-release-please-version
1111}
1212
13+ // Modules to publish (excludes examples)
14+ val publishableModules = setOf (
15+ " ans-sdk-api" ,
16+ " ans-sdk-core" ,
17+ " ans-sdk-crypto" ,
18+ " ans-sdk-registration" ,
19+ " ans-sdk-discovery" ,
20+ " ans-sdk-agent-client" ,
21+ " ans-sdk-transparency"
22+ )
23+
1324subprojects {
1425 apply (plugin = " java-library" )
1526 apply (plugin = " checkstyle" )
@@ -65,4 +76,77 @@ subprojects {
6576 }
6677 }
6778 }
79+
80+ // Apply publishing only to publishable modules
81+ if (name in publishableModules) {
82+ apply (plugin = " maven-publish" )
83+ apply (plugin = " signing" )
84+
85+ java {
86+ withSourcesJar()
87+ withJavadocJar()
88+ }
89+
90+ configure<PublishingExtension > {
91+ publications {
92+ create<MavenPublication >(" mavenJava" ) {
93+ from(components[" java" ])
94+
95+ pom {
96+ name.set(project.name)
97+ description.set(" ANS SDK - ${project.name} " )
98+ url.set(" https://github.com/godaddy/ans-sdk-java" )
99+
100+ licenses {
101+ license {
102+ name.set(" MIT License" )
103+ url.set(" https://opensource.org/licenses/MIT" )
104+ }
105+ }
106+
107+ developers {
108+ developer {
109+ id.set(" godaddy" )
110+ name.set(" GoDaddy" )
111+ email.set(" oswg@godaddy.com" )
112+ }
113+ }
114+
115+ scm {
116+ connection.set(" scm:git:git://github.com/godaddy/ans-sdk-java.git" )
117+ developerConnection.set(" scm:git:ssh://github.com/godaddy/ans-sdk-java.git" )
118+ url.set(" https://github.com/godaddy/ans-sdk-java" )
119+ }
120+ }
121+ }
122+ }
123+
124+ repositories {
125+ // Maven Central via Sonatype Central Portal
126+ maven {
127+ name = " mavenCentral"
128+ url = uri(" https://central.sonatype.com/api/v1/publisher/upload" )
129+
130+ credentials {
131+ username = System .getenv(" MAVEN_CENTRAL_USERNAME" )
132+ ? : project.findProperty(" mavenCentralUsername" ) as String? ? : " "
133+ password = System .getenv(" MAVEN_CENTRAL_PASSWORD" )
134+ ? : project.findProperty(" mavenCentralPassword" ) as String? ? : " "
135+ }
136+ }
137+ }
138+ }
139+
140+ configure<SigningExtension > {
141+ // Only sign when publishing to Maven Central (skip for local testing)
142+ setRequired({
143+ gradle.taskGraph.hasTask(" publishAllPublicationsToMavenCentralRepository" )
144+ })
145+
146+ // Use GPG command (key imported by actions/setup-java)
147+ useGpgCmd()
148+
149+ sign(the<PublishingExtension >().publications[" mavenJava" ])
150+ }
151+ }
68152}
0 commit comments