Skip to content

Commit

Permalink
Fix broken snapshot publishing (#4783)
Browse files Browse the repository at this point in the history
  • Loading branch information
cortinico committed Apr 27, 2022
1 parent ce10b73 commit 22bc63d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-snapshot.yaml
Expand Up @@ -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
2 changes: 1 addition & 1 deletion build-logic/src/main/kotlin/packaging.gradle.kts
Expand Up @@ -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)
}
}

Expand Down
21 changes: 21 additions & 0 deletions detekt-gradle-plugin/build.gradle.kts
Expand Up @@ -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"
Expand Down Expand Up @@ -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

0 comments on commit 22bc63d

Please sign in to comment.