Skip to content

Commit

Permalink
Use a Gradle property to differntiate between releases and snapshots
Browse files Browse the repository at this point in the history
Travis-CI is checking out a detached head
  • Loading branch information
chkpnt committed Apr 14, 2020
1 parent 92ad898 commit 9fcdc15
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ after_success:
- if [[ $TRAVIS_BRANCH == 'master' ]]; then ./scripts/publish-ghpages.sh; fi
- if [[ $TRAVIS_BRANCH == 'master' ]]; then ./scripts/publish-sonarqube.sh; fi
- if [[ $TRAVIS_BRANCH == 'master' ]]; then ./scripts/publish-codecov.sh; fi
- if [[ $TRAVIS_BRANCH == 'release' ]]; then ./scripts/deploy.sh; fi
- if [[ $TRAVIS_BRANCH == 'release' ]]; then ./scripts/deploy-release.sh; fi
6 changes: 4 additions & 2 deletions gradle/versioning.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ buildscript {

import org.ajoberstar.grgit.*

setToDefaultIfNotExists('isRelease', false)

task initBuildMetadata {
def major = 0
def minor = 4
def patch = 0
def repo = Grgit.open(dir: project.file('.'))
if (repo.branch.current().name == 'release') {
if (project.isRelease.toBoolean()) {
project.version = "${major}.${minor}.${patch}"
} else {
project.version = "${major}.${minor}.${patch}-SNAPSHOT"
}
def repo = Grgit.open(dir: project.file('.'))
project.ext.revision = repo.head().id
project.ext.buildDate = new Date().toString()
}
Expand Down
1 change: 1 addition & 0 deletions scripts/deploy.sh → scripts/deploy-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
-Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET \
-PbintrayUser=chkpnt \
-PbintrayApiKey=$BINTRAY_API_KEY \
-PisRelease=true \
bintrayUpload publishPlugins

0 comments on commit 9fcdc15

Please sign in to comment.