Skip to content

Commit 59826bf

Browse files
hui.zhaohui.zhao
authored andcommitted
#Changed#
git tag
1 parent 7fd5926 commit 59826bf

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ deploy:
4040
file: "./app/build/outputs/apk/release/app-release.apk"
4141
skip_cleanup: true
4242
on:
43+
tags: true
4344
branch: master
4445

4546
after_success:

CODE_OF_CONDUCT.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
## Deploy
44

55
1. update VERSION_NAME in gradle.properties(same as AndroidGodEye)
6-
2. PUSH master,查看编译状态:[AndroidGodEyeDemo-travis-ci](https://travis-ci.org/Kyson/AndroidGodEyeDemo)
6+
2. git tag VERSION_NAME
7+
3. push master,查看编译状态:[AndroidGodEyeDemo-travis-ci](https://travis-ci.org/Kyson/AndroidGodEyeDemo)
78

89
## Keystore
910

build.gradle

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,20 @@ task clean(type: Delete) {
2525
delete rootProject.buildDir
2626
}
2727

28-
String[] versionPart = String.valueOf(VERSION_NAME).split('\\.')
28+
def realVersionName = VERSION_NAME
29+
def TRAVIS_TAG = System.getenv("TRAVIS_TAG")
30+
if (TRAVIS_TAG != null && "" != TRAVIS_TAG) {
31+
realVersionName = TRAVIS_TAG
32+
println "[VERSION] Version name is [" + realVersionName + "] by git tag."
33+
} else {
34+
println "[VERSION] Version name is [" + realVersionName + "] by gradle.properties."
35+
}
36+
37+
String[] versionPart = String.valueOf(realVersionName).split('\\.')
2938
int realVersionCode = Integer.valueOf(versionPart[0]) * 1000000 + Integer.valueOf(versionPart[1]) * 1000 + Integer.valueOf(versionPart[2])
3039

3140
ext {
32-
REAL_VERSION_NAME = VERSION_NAME
41+
REAL_VERSION_NAME = realVersionName
3342
REAL_VERSION_CODE = realVersionCode
3443
}
3544

0 commit comments

Comments
 (0)