0.2.0-dev Download ZIP
38 lines ·1.4 KB Raw
| 1 | // Create variables with empty default values |
| 2 | ext["signing.keyId"] = '' |
| 3 | ext["signing.password"] = '' |
| 4 | ext["signing.key"] = '' |
| 5 | ext["ossrhGroupId"] = '' |
| 6 | ext["ossrhUsername"] = '' |
| 7 | ext["ossrhPassword"] = '' |
| 8 | ext["sonatypeStagingProfileId"] = '' |
| 9 | |
| 10 | File secretPropsFile = project.rootProject.file('local.properties') |
| 11 | if (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 |
| 28 | nexusPublishing { |
| 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 | } |