Skip to content

Commit 4deab45

Browse files
committed
refactor build.gradle to improve version handling and email
configuration
1 parent e65dad6 commit 4deab45

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

build.gradle

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ plugins {
99

1010
group = 'com.github.tonivade'
1111

12-
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
13-
1412
java {
1513
toolchain {
1614
languageVersion = JavaLanguageVersion.of(11)
@@ -118,23 +116,24 @@ publishing {
118116
developer {
119117
id = 'tonivade'
120118
name = 'Antonio Muñoz'
121-
email = 'antoniogmc@gmail.com'
119+
email = 'me@tonivade.es'
122120
}
123121
}
124122
}
125123
}
126124
}
127125
}
128126

129-
signing {
130-
def signingKey = project.findProperty("signingKey")
131-
def signingPassword = project.findProperty("signingPassword")
132-
useInMemoryPgpKeys(signingKey, signingPassword)
133-
sign publishing.publications.mavenJava
134-
}
127+
def isReleaseVersion = !version.endsWith("SNAPSHOT")
135128

136-
tasks.withType(Sign) {
137-
onlyIf { isReleaseVersion }
129+
signing {
130+
def signingKey = providers.gradleProperty("signingKey")
131+
def signingPassword = providers.gradleProperty("signingPassword")
132+
useInMemoryPgpKeys(signingKey.orNull, signingPassword.orNull)
133+
134+
if (isReleaseVersion) {
135+
sign publishing.publications.mavenJava
136+
}
138137
}
139138

140139
nexusPublishing {

0 commit comments

Comments
 (0)