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
|
// Applied here to allow publishing of artifactory build info
|
||||||
apply from: "${rootDir}/gradle/publish.gradle"
|
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) {
|
task wrapper(type: Wrapper) {
|
||||||
gradleVersion = '4.0'
|
gradleVersion = '4.0'
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ artifactoryPublish { task ->
|
||||||
throw new IllegalStateException("cannot run " + task + " with --parallel and --max-workers > 1")
|
throw new IllegalStateException("cannot run " + task + " with --parallel and --max-workers > 1")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
artifactory {
|
artifactory {
|
||||||
publish {
|
publish {
|
||||||
|
@ -83,17 +84,27 @@ artifactoryPublish { task ->
|
||||||
else
|
else
|
||||||
repoKey = isSnapshot ? 'oss-snapshot-local' : 'oss-release-local'
|
repoKey = isSnapshot ? 'oss-snapshot-local' : 'oss-release-local'
|
||||||
gradle.taskGraph.whenReady { taskGraph ->
|
gradle.taskGraph.whenReady { taskGraph ->
|
||||||
|
artifactoryPublish { task ->
|
||||||
if (taskGraph.hasTask(task)) {
|
if (taskGraph.hasTask(task)) {
|
||||||
username = bintrayUser
|
username = bintrayUser
|
||||||
password = bintrayApiKey
|
password = bintrayApiKey
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
defaults {
|
defaults {
|
||||||
if (!isRoot) publishConfigs('archives')
|
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")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bintray {
|
bintray {
|
||||||
|
@ -156,3 +167,7 @@ bintray {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!isSnapshot) {
|
||||||
|
artifactoryPublish.finalizedBy bintrayUpload
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue