Skip to content

Commit 9b966c6

Browse files
committed
provides build number for PRs
Signed-off-by: Oleh Dokuka <[email protected]>
1 parent 5d383fa commit 9b966c6

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

ci/travis.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,24 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
55
echo -e "Building PR #$TRAVIS_PULL_REQUEST [$TRAVIS_PULL_REQUEST_SLUG/$TRAVIS_PULL_REQUEST_BRANCH => $TRAVIS_REPO_SLUG/$TRAVIS_BRANCH]"
66
./gradlew build
77

8-
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ] && [ "$bintrayUser" != "" ] ; then
8+
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ] && [ "$bintrayUser" != "" ] && [ "$TRAVIS_BRANCH" == "develop" ] ; then
99

10-
echo -e "Building Snapshot $TRAVIS_REPO_SLUG/$TRAVIS_BRANCH"
10+
echo -e "Building Develop Snapshot $TRAVIS_REPO_SLUG/$TRAVIS_BRANCH/$TRAVIS_BUILD_NUMBER"
1111
./gradlew \
1212
-PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" \
1313
-PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" \
1414
-PversionSuffix="-SNAPSHOT" \
15+
-PbuildNumber="$TRAVIS_BUILD_NUMBER" \
16+
build artifactoryPublish --stacktrace
17+
18+
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ] && [ "$bintrayUser" != "" ] ; then
19+
20+
echo -e "Building Branch Snapshot $TRAVIS_REPO_SLUG/$TRAVIS_BRANCH/$TRAVIS_BUILD_NUMBER"
21+
./gradlew \
22+
-PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" \
23+
-PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" \
24+
-PversionSuffix="-$TRAVIS_BRANCH-SNAPSHOT" \
25+
-PbuildNumber="$TRAVIS_BUILD_NUMBER" \
1526
build artifactoryPublish --stacktrace
1627

1728
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ] && [ "$bintrayUser" != "" ] ; then
@@ -21,6 +32,7 @@ elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ] && [ "$bin
2132
-Pversion="$TRAVIS_TAG" \
2233
-PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" \
2334
-PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" \
35+
-PbuildNumber="$TRAVIS_BUILD_NUMBER" \
2436
build bintrayUpload --stacktrace
2537

2638
else

gradle/artifactory.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ if (project.hasProperty('bintrayUser') && project.hasProperty('bintrayKey')) {
3333
defaults {
3434
publications(publishing.publications.maven)
3535
}
36+
37+
if (project.hasProperty('buildNumber')) {
38+
clientConfig.info.setBuildNumber(project.property('buildNumber').toString())
39+
}
3640
}
3741
}
3842
tasks.named("artifactoryPublish").configure {

0 commit comments

Comments
 (0)