Skip to content

Instantly share code, notes, and snippets.

@hernandazevedo
Last active April 11, 2019 14:10
Show Gist options
  • Save hernandazevedo/838a15b70edbc5878e774b52c56613d9 to your computer and use it in GitHub Desktop.
Save hernandazevedo/838a15b70edbc5878e774b52c56613d9 to your computer and use it in GitHub Desktop.
ext {
localProp = new Properties()
fileName = 'local.properties'
if (project.rootProject.file(fileName).exists()) {
localProp.load(new FileInputStream(rootProject.file(fileName)))
}
groupName = "br.com.cetelem.android.components"
publishUsername = System.env.PUBLISH_USERNAME != null ? System.env.PUBLISH_USERNAME : localProp["publishUsername"] ?: ""
publishPassword = System.env.PUBLISH_PASSWORD != null ? System.env.PUBLISH_PASSWORD : localProp["publishPassword"] ?: ""
repoUrl = System.env.REPO_URL != null ? System.env.REPO_URL : localProp["repoUrl"] ?: ""
}
if (plugins.hasPlugin("com.android.library")) {
apply plugin: 'maven-publish'
if (!project.ext.properties.containsKey("artifactId")) {
ext.artifactId = project.name
}
publishing {
repositories {
maven {
credentials {
username publishUsername
password publishPassword
}
url repoUrl
}
}
publications {
projectRelease(MavenPublication) {
artifactId project.artifactId
groupId groupName
artifact "build/outputs/aar/${project.name}-release.aar"
version "${project.getVersion()}"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment