Skip to content

Commit 4ae2d8e

Browse files
committed
Merge pull request #5 from maiflai/master
only sign if publishing is possible
2 parents aa41fc9 + c040879 commit 4ae2d8e

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

build.gradle

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ buildscript {
77
}
88
}
99

10+
ext {
11+
sonatypeUser = System.env.SONATYPE_USER
12+
sonatypePass = System.env.SONATYPE_PASS
13+
}
14+
1015
apply plugin: 'idea'
1116
apply plugin: 'maven'
12-
apply plugin: 'signing'
1317
apply plugin: 'groovy'
1418
apply plugin: 'release'
1519

@@ -36,8 +40,11 @@ artifacts {
3640
archives sourcesJar
3741
}
3842

39-
signing {
40-
sign configurations.archives
43+
if (sonatypeUser) {
44+
apply plugin: 'signing'
45+
signing {
46+
sign configurations.archives
47+
}
4148
}
4249

4350
uploadArchives {
@@ -47,11 +54,11 @@ uploadArchives {
4754

4855

4956
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots') {
50-
authentication(userName: "$System.env.SONATYPE_USER", password: "$System.env.SONATYPE_PASS")
57+
authentication(userName: sonatypeUser, password: sonatypePass)
5158
}
5259

5360
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
54-
authentication(userName: "$System.env.SONATYPE_USER", password: "$System.env.SONATYPE_PASS")
61+
authentication(userName: sonatypeUser, password: sonatypePass)
5562
}
5663

5764
pom.project {

0 commit comments

Comments
 (0)