-
Notifications
You must be signed in to change notification settings - Fork 46
/
publish-root.gradle
37 lines (35 loc) · 1.54 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
File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
// Read local.properties file first if it exists
Properties p = new Properties()
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
p.each { name, value -> ext[name] = value }
} else {
// Use system environment variables
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
ext["signing.key"] = System.getenv('SIGNING_KEY')
ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
}
// Set up Sonatype repository
nexusPublishing {
repositories {
sonatype {
if ( project.hasProperty("ossrhUsername")
&& project.hasProperty("ossrhPassword")
&& project.hasProperty("sonatypeStagingProfileId")
&& project.hasProperty("signing.keyId")
&& project.hasProperty("signing.key")
&& project.hasProperty("signing.password")
) {
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/"))
}
}
}
}