Skip to content
0.2.0-dev Download ZIP
38 lines ·1.4 KB Raw
1// Create variables with empty default values
2ext["signing.keyId"] = ''
3ext["signing.password"] = ''
4ext["signing.key"] = ''
5ext["ossrhGroupId"] = ''
6ext["ossrhUsername"] = ''
7ext["ossrhPassword"] = ''
8ext["sonatypeStagingProfileId"] = ''
9
10File secretPropsFile = project.rootProject.file('local.properties')
11if (secretPropsFile.exists()) {
12 // Read local.properties file first if it exists
13 Properties p = new Properties()
14 new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
15 p.each { name, value -> ext[name] = value }
16} else {
17 // Use system environment variables
18 ext["ossrhGroupId"] = System.getenv('OSSRH_GROUP_ID')
19 ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME')
20 ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD')
21 ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID')
22 ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
23 ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
24 ext["signing.key"] = System.getenv('SIGNING_KEY')
25}
26
27// Set up Sonatype repository
28nexusPublishing {
29 repositories {
30 sonatype {
31 stagingProfileId = sonatypeStagingProfileId
32 username = ossrhUsername
33 password = ossrhPassword
34 nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
35 snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
36 }
37 }
38}