|
| 1 | +// Create variables with empty default values |
| 2 | +ext["signing.keyId"] = '' |
| 3 | +ext["signing.key"] = '' |
| 4 | +ext["signing.password"] = '' |
| 5 | +ext["centralTokenUsername"] = '' |
| 6 | +ext["centralTokenPassword"] = '' |
| 7 | +ext["sonatypeStagingProfileId"] = '' |
| 8 | + |
| 9 | +File globalSecretPropsFile = file('../scripts/android/local.properties') |
| 10 | +File secretPropsFile = project.rootProject.file('local.properties') |
| 11 | +if (globalSecretPropsFile.exists()) { |
| 12 | + println "Reading globalSecretPropsFile" |
| 13 | + // Read global local.properties file first if it exists (scripts/android/local.properties) |
| 14 | + Properties p = new Properties() |
| 15 | + new FileInputStream(globalSecretPropsFile).withCloseable { is -> p.load(is) } |
| 16 | + p.each { name, value -> ext[name] = value } |
| 17 | +} else if (secretPropsFile.exists()) { |
| 18 | + // Read plugin project specific local.properties file next if it exists |
| 19 | + Properties p = new Properties() |
| 20 | + new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) } |
| 21 | + p.each { name, value -> ext[name] = value } |
| 22 | +} else { |
| 23 | + // Use system environment variables |
| 24 | + ext["centralTokenUsername"] = System.getenv('ANDROID_CENTRAL_USERNAME') |
| 25 | + ext["centralTokenPassword"] = System.getenv('ANDROID_CENTRAL_PASSWORD') |
| 26 | + ext["sonatypeStagingProfileId"] = System.getenv('ANDROID_SONATYPE_STAGING_PROFILE_ID') |
| 27 | + ext["signing.keyId"] = System.getenv('ANDROID_SIGNING_KEY_ID') |
| 28 | + ext["signing.key"] = System.getenv('ANDROID_SIGNING_KEY') |
| 29 | + ext["signing.password"] = System.getenv('ANDROID_SIGNING_PASSWORD') |
| 30 | +} |
| 31 | + |
| 32 | +// Set up Sonatype repository |
| 33 | +nexusPublishing { |
| 34 | + repositories { |
| 35 | + sonatype { |
| 36 | + stagingProfileId = sonatypeStagingProfileId |
| 37 | + username = centralTokenUsername |
| 38 | + password = centralTokenPassword |
| 39 | + nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/")) |
| 40 | + snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/")) |
| 41 | + } |
| 42 | + } |
| 43 | + repositoryDescription = 'Capacitor Android ' + System.getenv('PLUGIN_NAME') + ' plugin v' + System.getenv('PLUGIN_VERSION') |
| 44 | +} |
0 commit comments