Automatically publish to bintray after artifactory
This commit is contained in:
parent
a790e7b9f7
commit
43436999c4
|
@ -27,28 +27,6 @@ description = 'dd-trace-java'
|
|||
// Applied here to allow publishing of artifactory build info
|
||||
apply from: "${rootDir}/gradle/publish.gradle"
|
||||
|
||||
// Source: https://github.com/ratpack/ratpack/blob/master/ratpack.gradle#L101
|
||||
task bintrayPublish() {
|
||||
doLast {
|
||||
if (!project.hasProperty("bintrayApiKey") || bintrayApiKey.length() < 20) {
|
||||
throw new InvalidUserDataException("You must provide a valid bintrayApiKey")
|
||||
}
|
||||
|
||||
if (!project.hasProperty('buildNumber') || !"$buildNumber".isInteger()) {
|
||||
throw new TaskExecutionException("Must provide buildNumber of a release from https://oss.jfrog.org/artifactory/webapp/#/builds/dd-trace-java")
|
||||
}
|
||||
|
||||
def curl = [
|
||||
'curl',
|
||||
'-X', 'POST',
|
||||
'-u', "${bintrayUser}:${bintrayApiKey}",
|
||||
'-d', '',
|
||||
"http://oss.jfrog.org/api/plugins/build/promote/snapshotsToBintray/dd-trace-java/$project.buildNumber"
|
||||
].execute()
|
||||
logger.info("Received response: ${curl.text}")
|
||||
}
|
||||
}
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = '4.0'
|
||||
}
|
||||
|
|
|
@ -73,25 +73,36 @@ artifactoryPublish { task ->
|
|||
throw new IllegalStateException("cannot run " + task + " with --parallel and --max-workers > 1")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
artifactory {
|
||||
publish {
|
||||
contextUrl = forceLocal ? 'http://localhost:8080/artifactory' : 'https://oss.jfrog.org'
|
||||
repository {
|
||||
if (forceLocal)
|
||||
repoKey = isSnapshot ? 'libs-snapshot-local' : 'libs-release-local'
|
||||
else
|
||||
repoKey = isSnapshot ? 'oss-snapshot-local' : 'oss-release-local'
|
||||
gradle.taskGraph.whenReady { taskGraph ->
|
||||
artifactory {
|
||||
publish {
|
||||
contextUrl = forceLocal ? 'http://localhost:8080/artifactory' : 'https://oss.jfrog.org'
|
||||
repository {
|
||||
if (forceLocal)
|
||||
repoKey = isSnapshot ? 'libs-snapshot-local' : 'libs-release-local'
|
||||
else
|
||||
repoKey = isSnapshot ? 'oss-snapshot-local' : 'oss-release-local'
|
||||
gradle.taskGraph.whenReady { taskGraph ->
|
||||
artifactoryPublish { task ->
|
||||
if (taskGraph.hasTask(task)) {
|
||||
username = bintrayUser
|
||||
password = bintrayApiKey
|
||||
}
|
||||
}
|
||||
}
|
||||
defaults {
|
||||
if (!isRoot) publishConfigs('archives')
|
||||
}
|
||||
}
|
||||
defaults {
|
||||
if (!isRoot) publishConfigs('archives')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bintrayUpload { task ->
|
||||
gradle.taskGraph.whenReady { taskGraph ->
|
||||
def startParameter = project.gradle.startParameter
|
||||
if (taskGraph.hasTask(task) && startParameter.parallelProjectExecutionEnabled && startParameter.maxWorkerCount > 1) {
|
||||
throw new IllegalStateException("cannot run " + task + " with --parallel and --max-workers > 1")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,3 +167,7 @@ bintray {
|
|||
// }
|
||||
}
|
||||
}
|
||||
|
||||
if(!isSnapshot) {
|
||||
artifactoryPublish.finalizedBy bintrayUpload
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue