Skip to content

Commit 91db292

Browse files
committed
Apply Nexus publishing plugin conditionally
1 parent f207b27 commit 91db292

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

build.gradle

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ buildscript {
44
}
55
dependencies {
66
classpath 'com.cinnober.gradle:semver-git:2.5.0'
7+
8+
if (project.findProperty('yubicoPublish') == 'true') {
9+
classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
10+
}
711
}
812
}
913
plugins {
1014
id 'java-platform'
11-
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
1215

1316
// The root project has no sources, but the dependency platform also needs to be published as an artifact
1417
// See https://docs.gradle.org/current/userguide/java_platform_plugin.html
@@ -21,10 +24,7 @@ import com.yubico.gradle.GitUtils
2124
rootProject.description = "Metadata root for the com.yubico:webauthn-server-* module family"
2225

2326
project.ext.isCiBuild = System.env.CI == 'true'
24-
25-
project.ext.publishEnabled = !isCiBuild &&
26-
project.hasProperty('yubicoPublish') && project.yubicoPublish &&
27-
project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')
27+
project.ext.publishEnabled = !isCiBuild && project.findProperty('yubicoPublish') == 'true'
2828

2929
wrapper {
3030
gradleVersion = '8.1.1'
@@ -65,6 +65,8 @@ allprojects {
6565
}
6666

6767
if (publishEnabled) {
68+
apply plugin: 'io.github.gradle-nexus.publish-plugin'
69+
6870
nexusPublishing {
6971
repositories {
7072
sonatype {

0 commit comments

Comments
 (0)