Fix broken snapshot publishing (#4783)

This commit is contained in:
Nicola Corti
2022-04-27 18:08:10 +01:00
committed by GitHub
parent ce10b73a5c
commit 22bc63dabb
3 changed files with 23 additions and 2 deletions

View File

@@ -35,4 +35,4 @@ jobs:
ORG_GRADLE_PROJECT_SONATYPE_USERNAME: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_SONATYPE_PASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SONATYPE_PASSWORD }}
with:
arguments: publishAllPublicationsToSonatypeSnapshotRepository -Dsnapshot=true --stacktrace
arguments: publishAllToSonatypeSnapshot -Dsnapshot=true --stacktrace

View File

@@ -68,7 +68,7 @@ if (signingKey.isNullOrBlank() || signingPwd.isNullOrBlank()) {
logger.info("GPG Key found - Signing enabled")
signing {
useInMemoryPgpKeys(signingKey, signingPwd)
sign(publishing.publications[DETEKT_PUBLICATION])
publishing.publications.forEach(::sign)
}
}

View File

@@ -6,6 +6,7 @@ plugins {
`java-gradle-plugin`
`java-test-fixtures`
idea
signing
alias(libs.plugins.pluginPublishing)
// We use this published version of the Detekt plugin to self analyse this project.
id("io.gitlab.arturbosch.detekt") version "1.20.0"
@@ -157,3 +158,23 @@ with(components["java"] as AdhocComponentWithVariants) {
withVariantsFromConfiguration(configurations["testFixturesApiElements"]) { skip() }
withVariantsFromConfiguration(configurations["testFixturesRuntimeElements"]) { skip() }
}
tasks.withType<Sign>().configureEach {
notCompatibleWithConfigurationCache("https://github.com/gradle/gradle/issues/13470")
}
val signingKey = "SIGNING_KEY".byProperty
val signingPwd = "SIGNING_PWD".byProperty
if (signingKey.isNullOrBlank() || signingPwd.isNullOrBlank()) {
logger.info("Signing disabled as the GPG key was not found")
} else {
logger.info("GPG Key found - Signing enabled")
afterEvaluate {
signing {
useInMemoryPgpKeys(signingKey, signingPwd)
publishing.publications.forEach(::sign)
}
}
}
val String.byProperty: String? get() = findProperty(this) as? String