publish-root.gradle 1.1 KB
// Create variables with empty default values

// Central Portal credentials
ext["centralPortalUsername"] = ''
ext["centralPortalPassword"] = ''

// keyId is the last 8 characters of the GPG key
ext["signing.keyId"] = ''
// password is the passphrase of the GPG key
ext["signing.password"] = ''
// key is the base64 private GPG key
ext["signing.key"] = ''

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 for signing
    ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID')
    ext["signing.password"] = System.getenv('SIGNING_PASSWORD')
    ext["signing.key"] = System.getenv('SIGNING_KEY')
    // Central Portal credentials can also come from environment
    ext["centralPortalUsername"] = System.getenv('CENTRAL_PORTAL_USERNAME')
    ext["centralPortalPassword"] = System.getenv('CENTRAL_PORTAL_PASSWORD')
}