Skip to content

Commit 8d2d9aa

Browse files
tylerbensonAndrew Kent
authored andcommitted
Try releasing from tags (#241)
1 parent 0bfa65f commit 8d2d9aa

2 files changed

Lines changed: 46 additions & 14 deletions

File tree

.circleci/config.yml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ jobs:
114114
key: dd-trace-java-version-scan-{{ checksum "dd-trace-java.gradle" }}
115115
paths: ~/.gradle
116116

117-
deploy:
117+
publish: &publish
118118
<<: *defaults
119119
steps:
120120
- checkout
@@ -129,41 +129,72 @@ jobs:
129129
- deploy:
130130
name: Publish master to Artifactory
131131
command: |
132-
if [ "${CIRCLE_BRANCH}" == "master" ]; then
133-
./gradlew -Psigning.keyId=${PGP_KEY_ID} \
134-
-Psigning.password=${PGP_KEY_PASS} \
135-
-Psigning.secretKeyRingFile=/home/circleci/dd-trace-java/.circleci/secring.gpg \
136-
-PbintrayUser=${BINTRAY_USER} \
137-
-PbintrayApiKey=${BINTRAY_API_KEY} \
138-
-PbuildInfo.build.number=${CIRCLE_BUILD_NUM} \
139-
artifactoryPublish --max-workers=1 --stacktrace --no-daemon
140-
fi
132+
./gradlew -Psigning.keyId=${PGP_KEY_ID} \
133+
-Psigning.password=${PGP_KEY_PASS} \
134+
-Psigning.secretKeyRingFile=/home/circleci/dd-trace-java/.circleci/secring.gpg \
135+
-PbintrayUser=${BINTRAY_USER} \
136+
-PbintrayApiKey=${BINTRAY_API_KEY} \
137+
-PbuildInfo.build.number=${CIRCLE_BUILD_NUM} \
138+
artifactoryPublish --max-workers=1 --stacktrace --no-daemon
139+
140+
publish_master:
141+
<<: *publish
142+
publish_tag:
143+
<<: *publish
141144

142145
workflows:
143146
version: 2
144147
build_test_deploy:
145148
jobs:
146-
- build
149+
- build:
150+
filters:
151+
tags:
152+
only: /.*/
147153

148154
- test_7:
149155
requires:
150156
- build
157+
filters:
158+
tags:
159+
only: /.*/
151160
- test_8:
152161
requires:
153162
- build
163+
filters:
164+
tags:
165+
only: /.*/
154166
- test_9:
155167
requires:
156168
- build
169+
filters:
170+
tags:
171+
only: /.*/
172+
157173
- scan_versions:
158174
requires:
159175
- build
176+
filters:
177+
branches:
178+
ignore: master
160179

161-
- deploy:
180+
- publish_master:
162181
requires:
163182
- test_7
164183
- test_8
165184
- test_9
166-
- scan_versions
167185
filters:
168186
branches:
169187
only: master
188+
tags:
189+
ignore: /.*/
190+
191+
- publish_tag:
192+
requires:
193+
- test_7
194+
- test_8
195+
- test_9
196+
filters:
197+
branches:
198+
ignore: /.*/
199+
tags:
200+
only: /^v.*/

gradle/publish.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ if (!isRoot) {
6363
}
6464

6565
def isSnapshot = version.endsWith("-SNAPSHOT")
66+
def isCIandTagged = System.getenv("CIRCLE_TAG") != null
6667
// define in ~/.gradle/gradle.properties to override for testing
6768
def forceLocal = project.hasProperty('forceLocal') && forceLocal
6869

@@ -151,6 +152,6 @@ bintray {
151152
}
152153
}
153154

154-
if (!isSnapshot) {
155+
if (!isSnapshot && isCIandTagged) {
155156
artifactoryPublish.finalizedBy bintrayUpload
156157
}

0 commit comments

Comments
 (0)