-
Notifications
You must be signed in to change notification settings - Fork 32
/
publish-root.gradle
50 lines (47 loc) · 1.58 KB
/
publish-root.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
ext["sonatypeStagingProfileId"] = ''
File localProps = rootProject.file('local.properties')
if (localProps.exists()) {
Properties p = new Properties()
new FileInputStream(localProps).withCloseable { is -> p.load(is) }
p.each { name, value -> ext[name] = value }
} else {
Properties p = new Properties()
p.putAll(System.getenv())
ext["signing.secretKeyRingFile"] = "${project.rootDir}/sonatype.gpg"
p.each { name, value ->
switch (name) {
case "OSSRH_USERNAME":
ext["ossrhUsername"] = value
break
case "OSSRH_PASSWORD":
ext["ossrhPassword"] = value
break
case "SONATYPE_SINGING_KEY_ID":
ext["signing.keyId"] = value
break
case "SONATYPE_SINGING_KEY_PASSWORD":
ext["signing.password"] = value
break
case "SONATYPE_STAGING_PROFILE_ID":
ext["sonatypeStagingProfileId"] = value
break
}
}
}
// Set up Sonatype repository
nexusPublishing {
repositories {
sonatype {
stagingProfileId = sonatypeStagingProfileId
username = ossrhUsername
password = ossrhPassword
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}