Skip to content

Instantly share code, notes, and snippets.

@indranil32
Created February 15, 2020 09:51
Show Gist options
  • Save indranil32/fb5b922988c52bb4f89e89b23afe922e to your computer and use it in GitHub Desktop.
Save indranil32/fb5b922988c52bb4f89e89b23afe922e to your computer and use it in GitHub Desktop.
apply plugin: 'maven-publish'
..
..
def versionMajor = 1
def versionMinor = 0
def versionPatch = 0
..
..
publishing {
repositories {
maven {
// internal CI builds
url uploadRepoSnapshotUrl
credentials {
username uploadRepoUsername
password uploadRepoPassword
}
}
}
publications {
create("apk-nexus-upload", MavenPublication) {
afterEvaluate {
android.applicationVariants.all { variant ->
variant.outputs.each { output ->
// only upload release builds
if (variant.name == "release") {
groupId uploadGroupId
artifactId uploadArtifactId
// "${versionMajor}.${versionMinor}.${versionPatch}-${versionBuild}"
version "${versionMajor}.${versionMinor}.${versionPatch}." + uploadBuildNumber
artifact(output.outputFile)
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment