diff --git a/build.gradle.kts b/build.gradle.kts index 6073dce8d..4c798588c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -37,3 +37,11 @@ val detektAll = tasks.register("detektAll") { html.required.set(false) } } + +tasks.withType().configureEach { + onlyIf { + val isReleaseQueued = gradle.taskGraph.hasTask("publishAllPublicationsTo${sonatypeReleasesRepoName}Repository") + val isSnapshotQueued = gradle.taskGraph.hasTask("publishAllPublicationsTo${sonatypeSnapshotsRepoName}Repository") + isReleaseQueued || isSnapshotQueued + } +}