Skip to content

Instantly share code, notes, and snippets.

@rogerhu
Created October 28, 2016 06:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rogerhu/0bcbd1573f594abca4a7f156af247d48 to your computer and use it in GitHub Desktop.
Save rogerhu/0bcbd1573f594abca4a7f156af247d48 to your computer and use it in GitHub Desktop.
// Inspired from https://gist.github.com/adrianbk/c4982e5ebacc6b6ed902
apply plugin: 'maven-publish'
def isReleaseBuild() {
return VERSION_NAME.contains("SNAPSHOT") == false
}
def getOutputDir() {
if (isReleaseBuild()) {
return "${project.buildDir}/releases"
} else {
return "${project.buildDir}/snapshots"
}
}
def getDestUrl() {
if (isReleaseBuild()) {
return "s3://my-bucket/releases"
} else {
return "s3://my-bucket/snapshots"
}
}
publishing {
publications {
myPublication (MavenPublication) {
groupId GROUP
artifactId POM_ARTIFACT_ID
version VERSION_NAME
}
}
repositories {
maven {
url getDestUrl()
credentials(AwsCredentials) {
accessKey = "key"
secretKey = "password"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment