Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken snapshot publishing #4783

Merged
merged 2 commits into from Apr 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)
}

Expand Down Expand Up @@ -145,3 +146,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