File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed
Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,16 @@ val publishVersion = providers.gradleProperty("PUBLISH_VERSION").orNull
66 ? : project.property(" navEntryScopeVersion" ) as String
77project.extra.set(" publishVersion" , publishVersion)
88
9+ // Check if this is a SNAPSHOT version
10+ val isSnapshot = publishVersion.endsWith(" -SNAPSHOT" )
11+ project.extra.set(" isSnapshot" , isSnapshot)
12+
913// Support both in-memory signing (CI) and file-based signing (local)
1014val hasSigningCredentials = project.findProperty(" signingInMemoryKey" ) != null
1115 || project.findProperty(" signing.secretKeyRingFile" ) != null
1216project.extra.set(" hasSigningCredentials" , hasSigningCredentials)
1317
18+
1419// Shared POM configuration function - available via extra properties
1520project.extra.set(" configurePom" ) { pom: org.gradle.api.publish.maven.MavenPom ->
1621 pom.apply {
Original file line number Diff line number Diff line change @@ -63,13 +63,17 @@ extra["navEntryScopeVersion"] = libs.versions.navEntryScope.get()
6363apply (from = rootProject.file(" gradle/publishing.gradle.kts" ))
6464
6565val hasSigningCredentials = extra[" hasSigningCredentials" ] as Boolean
66+ val isSnapshot = extra[" isSnapshot" ] as Boolean
6667@Suppress(" UNCHECKED_CAST" )
6768val configurePom = extra[" configurePom" ] as (MavenPom ) -> Unit
6869
6970mavenPublishing {
7071 configure(AndroidSingleVariantLibrary (variant = " release" , sourcesJar = true , publishJavadocJar = true ))
7172
72- if (hasSigningCredentials) {
73+ // SNAPSHOTs can be published without signing; release versions require signing
74+ if (isSnapshot) {
75+ publishToMavenCentral()
76+ } else if (hasSigningCredentials) {
7377 publishToMavenCentral()
7478 signAllPublications()
7579 }
Original file line number Diff line number Diff line change @@ -29,13 +29,17 @@ extra["navEntryScopeVersion"] = libs.versions.navEntryScope.get()
2929apply (from = rootProject.file(" gradle/publishing.gradle.kts" ))
3030
3131val hasSigningCredentials = extra[" hasSigningCredentials" ] as Boolean
32+ val isSnapshot = extra[" isSnapshot" ] as Boolean
3233@Suppress(" UNCHECKED_CAST" )
3334val configurePom = extra[" configurePom" ] as (MavenPom ) -> Unit
3435
3536mavenPublishing {
3637 configure(JavaLibrary (javadocJar = JavadocJar .Javadoc (), sourcesJar = true ))
3738
38- if (hasSigningCredentials) {
39+ // SNAPSHOTs can be published without signing; release versions require signing
40+ if (isSnapshot) {
41+ publishToMavenCentral()
42+ } else if (hasSigningCredentials) {
3943 publishToMavenCentral()
4044 signAllPublications()
4145 }
You can’t perform that action at this time.
0 commit comments