Upload to artifactory on merge to master
MODIFY
.circleci/config.yml
.circleci/config.yml
@@ -9,7 +9,7 @@ jobs:
- checkout
- restore_cache:
- key: dd-trace-java-{{ checksum "dd-trace-java.gradle" }}-{{ checksum "dd-java-agent/dd-java-agent.gradle" }}-{{ checksum "dd-trace/dd-trace.gradle" }}
+ key: dd-trace-java
- run:
name: Run Tests
@@ -18,7 +18,7 @@ jobs:
- save_cache:
paths:
- ~/.gradle
- key: dd-trace-java-{{ checksum "dd-trace-java.gradle" }}-{{ checksum "dd-java-agent/dd-java-agent.gradle" }}-{{ checksum "dd-trace/dd-trace.gradle" }}
+ key: dd-trace-java
- store_test_results:
path: dd-java-agent/build/test-results
@@ -38,3 +38,10 @@ jobs:
path: dd-java-agent/build/libs
- store_artifacts:
path: dd-trace/build/libs
+
+ - deploy:
+ name: Publish master to Artifactory
+ command: |
+ if [ "${CIRCLE_BRANCH}" == "master" ]; then
+ ./gradlew -PbintrayUser=${BINTRAY_USER} -PbintrayApiKey=${BINTRAY_API_KEY} artifactoryPublish
+ fi

MODIFY
gradle/publish.gradle
gradle/publish.gradle
@@ -31,7 +31,7 @@ tasks.withType(Upload).matching { it.name != "install" }.all {
}
}
-def isSnapshot = !version.endsWith("-SNAPSHOT")
+def isSnapshot = version.endsWith("-SNAPSHOT")
//if (!isSnapshot) {
// tasks.withType(Upload) {
@@ -100,13 +100,18 @@ artifacts {
archives javaDocJar
}
+// define in ~/.gradle/gradle.properties to override for testing
+def forceLocal = project.hasProperty('forceLocal') && forceLocal
+
artifactoryPublish { task ->
artifactory {
publish {
- contextUrl = 'http://localhost:8080/artifactory'
+ contextUrl = forceLocal ? 'http://localhost:8080/artifactory' : 'https://oss.jfrog.org'
repository {
- repoKey = !isSnapshot ? 'libs-snapshot-local' : 'libs-release-local'
-// repoKey = isSnapshot ? 'oss-snapshot-local' : 'oss-release-local'
+ if(forceLocal)
+ repoKey = isSnapshot ? 'libs-snapshot-local' : 'libs-release-local'
+ else
+ repoKey = isSnapshot ? 'oss-snapshot-local' : 'oss-release-local'
gradle.taskGraph.whenReady { taskGraph ->
if (taskGraph.hasTask(task)) {
username = bintrayUser

Upload to artifactory on merge to master