File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 11// Shared publishing configuration for Vanniktech Maven Publish plugin
22// Secrets are loaded from ~/.gradle/gradle.properties (see README for required keys)
33
4- // Get version from PUBLISH_VERSION property or fall back to navEntryScopeVersion
5- val publishVersion = providers.gradleProperty(" PUBLISH_VERSION" ).orNull
6- ? : project.property(" navEntryScopeVersion" ) as String
4+ // Version must be provided via -PPUBLISH_VERSION when publishing
5+ val isPublishTask = gradle.startParameter.taskNames.any { it.contains(" publish" , ignoreCase = true ) }
6+ val publishVersion = if (isPublishTask) {
7+ providers.gradleProperty(" PUBLISH_VERSION" ).orNull
8+ ? : error(" PUBLISH_VERSION property is required. Use -PPUBLISH_VERSION=x.y.z-SNAPSHOT" )
9+ } else {
10+ providers.gradleProperty(" PUBLISH_VERSION" ).orNull ? : " UNSPECIFIED"
11+ }
712project.extra.set(" publishVersion" , publishVersion)
813
914// Check if this is a SNAPSHOT version
You can’t perform that action at this time.
0 commit comments