Skip to content

Commit bfc9d1b

Browse files
author
Josh Deffibaugh
committed
Manage release versions via TRAVIS_TAG var
1 parent 5ec97e4 commit bfc9d1b

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ before_script:
2323
- adb shell input keyevent 82 &
2424
script:
2525
- ./gradlew testAllModules
26-
- if [[ ( "$TRAVIS_BRANCH" == "beta" || "$TRAVIS_BRANCH" == "master" ) && ( -z "$TRAVIS_TAG") ]]; then ./gradlew ship; fi
26+
- if [[ ( "$TRAVIS_BRANCH" == "beta" || "$TRAVIS_BRANCH" == "master" ) && ( -n "$TRAVIS_TAG") ]]; then ./gradlew ship; fi

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,18 @@ Tests can be run by right clicking the file in the project pane or by clicking t
8080

8181
## Releasing
8282

83-
The default branch is devel. Feature branch PRs are automatically made against it. When PRs are reviewed and pass checks they should be squashed and merged into devel. The version of the SDK in devel should always be the version of the next release plus `-SNAPSHOT`.
83+
The default branch is devel. Feature branch PRs are automatically made against it. When PRs are reviewed and pass checks they should be squashed and merged into devel. Devel will be built and tested for each commit.
8484

85-
If a beta, or snapshot, build needs to be published simply checkout beta and merge devel. The beta branch should fast forward. Push devel and Travis will start. If the tests pass the build will be sent to our Maven repos on Bintray.
85+
Versions are managed via git tags. Tags can be created from the command line or from the Github UI.
8686

87-
When a release version needs to be published checkout the master branch and merge devel. The master branch should be fast forwarded. Remove the `-SNAPSHOT` from the version in `build.gradle` and commit directly onto master. Push master and if the tests pass Travis will publish the version to our Maven repos on Bintray. if the version already exists on Bintray the upload will be rejected. The commit that updates the version should also be tagged with the version number.
87+
Snapshot builds are made off of the beta branch. Travis will test all commits to this branch. When commit is tagged and pushed travis will build, test, *and*, ship the build bintray. The version name used
88+
is the name of the tag. For snapshot builds the version should have `-SNAPSHOT` appended. For example `0.1.2-SNAPSHOT`. Multiple builds with the same version can be pushed to Bintray when using snapshot versions.
89+
This keeps the version number from increasing too quickly for beta builds. Grade and maven ensure that users are on the latest snapshot via timestamps.
90+
There can be only one git tag per version name so snapshot tags may need to be moved. For example `git tag -f -a 0.1.2` and `git push -f --tags`.
8891

89-
Once the next release has been published from the master branch the snapshot version in devel should be bumped to the next targeted version.
92+
Release builds are made off of the master branch. Travis will test all commits to this branch. Just like the beta branch, pushing a tag will trigger a build, tests, and release of the version of the tag to Bintray.
93+
For example, to release version 0.1.2 you need to pull devel, checkout master, pull master, fast-forward master to devel, push master, then release 0.1.2 on Github, which creates a tag. You could also run
94+
`git tag -a 0.1.2 -m 'Version 0.1.2`. The argument to `-a` is the actual version name used on Bintray so it must be exact. Then run `git push --tags` to trigger Travis.
9095

9196
*Note:* only Optimizely employees can push to master, beta, and devel branches.
9297

build.gradle

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@
1717
// Top-level build file where you can add configuration options common to all sub-projects/modules.
1818

1919
buildscript {
20-
def bintrayUser = System.getenv('BINTRAY_USER')
21-
def bintrayApiKey = System.getenv('BINTRAY_API_KEY')
22-
if (bintrayUser != null && bintrayApiKey != null) {
23-
rootProject.ext.bintray_user = bintrayUser
24-
rootProject.ext.bintray_api_key = bintrayApiKey
20+
def bintray_user = System.getenv('BINTRAY_USER')
21+
def bintray_api_key = System.getenv('BINTRAY_API_KEY')
22+
def version_name = System.getenv('TRAVIS_TAG')
23+
if (bintray_user != null && bintray_api_key != null && version_name != null) {
24+
rootProject.ext.bintray_user = bintray_user
25+
rootProject.ext.bintray_api_key = bintray_api_key
26+
rootProject.ext.version_name = version_name
2527
} else {
2628
rootProject.ext.bintray_user = ''
2729
rootProject.ext.bintray_api_key = ''
30+
rootProject.ext.version_name= ''
2831
}
2932
repositories {
3033
jcenter()

0 commit comments

Comments
 (0)