Skip to content

Commit 707c52c

Browse files
misaochanmaskaravivek
authored andcommitted
Automate releases (part 1) (commons-app#2111)
* Encrypt keystore * Modify build.gradle to add signing configs for env vars * Fixed keystore name * Remove encrypted file that is causing build errors * Add encrypted keystore again * Remove failed keystore again... * Add keystore encrypted by Nicolas * Modify env var names for key and iv
1 parent 1d951f5 commit 707c52c

File tree

3 files changed

+45
-37
lines changed

3 files changed

+45
-37
lines changed

.travis.yml

+30-37
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,47 @@
11
language: android
2-
32
addons:
43
apt:
54
packages:
6-
- w3m
7-
5+
- w3m
86
env:
97
global:
10-
- ANDROID_TARGET=android-22
11-
- ANDROID_ABI=armeabi-v7a
12-
- ADB_INSTALL_TIMEOUT=12 # in minutes
13-
8+
- ANDROID_TARGET=android-22
9+
- ANDROID_ABI=armeabi-v7a
10+
- ADB_INSTALL_TIMEOUT=12
1411
jdk:
15-
- oraclejdk8
16-
12+
- oraclejdk8
1713
android:
1814
components:
19-
- tools
20-
- platform-tools
21-
- build-tools-27.0.3
22-
- extra-google-m2repository
23-
- extra-android-m2repository
24-
- android-22
25-
- android-27
26-
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
15+
- tools
16+
- platform-tools
17+
- build-tools-27.0.3
18+
- extra-google-m2repository
19+
- extra-android-m2repository
20+
- android-22
21+
- android-27
22+
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
2723
licenses:
28-
- 'android-sdk-license-.+'
29-
24+
- android-sdk-license-.+
3025
before_script:
31-
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
32-
- emulator -avd test -no-audio -no-window -no-boot-anim &
33-
- android-wait-for-emulator
34-
26+
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
27+
- emulator -avd test -no-audio -no-window -no-boot-anim &
28+
- android-wait-for-emulator
3529
script:
36-
- ./gradlew clean check connectedCheck jacocoTestReport
37-
30+
- "./gradlew clean check connectedCheck jacocoTestReport"
3831
after_success:
39-
- bash <(curl -s https://codecov.io/bash)
40-
32+
- bash <(curl -s https://codecov.io/bash)
4133
after_failure:
42-
- echo '*** Debug Unit Test Results ***'
43-
- w3m -dump ${TRAVIS_BUILD_DIR}/app/build/reports/tests/*/classes/*Test.html
44-
- echo '*** Connected Test Results ***'
45-
- w3m -dump ${TRAVIS_BUILD_DIR}/app/build/reports/androidTests/connected/flavors/*/*Test.html
46-
34+
- echo '*** Debug Unit Test Results ***'
35+
- w3m -dump ${TRAVIS_BUILD_DIR}/app/build/reports/tests/*/classes/*Test.html
36+
- echo '*** Connected Test Results ***'
37+
- w3m -dump ${TRAVIS_BUILD_DIR}/app/build/reports/androidTests/connected/flavors/*/*Test.html
4738
before_cache:
48-
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
49-
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
50-
39+
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
40+
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
5141
cache:
5242
directories:
53-
- $HOME/.gradle/caches/
54-
- $HOME/.gradle/wrapper/
43+
- "$HOME/.gradle/caches/"
44+
- "$HOME/.gradle/wrapper/"
45+
before_install:
46+
- openssl aes-256-cbc -K $encrypted_7b5c925cc32c_key -iv $encrypted_7b5c925cc32c_iv
47+
-in nr-commons.keystore.enc -out nr-commons.keystore -d

app/build.gradle

+15
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,17 @@ android {
117117
test.assets.srcDirs += 'src/main/assets'
118118
test.resources.srcDirs += 'src/main/resoures'
119119
}
120+
121+
signingConfigs {
122+
release
123+
}
120124

121125
buildTypes {
122126
release {
123127
minifyEnabled true
124128
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
125129
testProguardFile 'test-proguard-rules.txt'
130+
signingConfig signingConfigs.release
126131
}
127132
debug {
128133
minifyEnabled true
@@ -132,6 +137,16 @@ android {
132137
versionNameSuffix "-debug-" + getBranchName() + "~" + getBuildVersion()
133138
}
134139
}
140+
141+
def isRunningOnTravis = System.getenv("CI") == "true"
142+
143+
if (isRunningOnTravis) {
144+
// configure keystore based on env vars in Travis for automated alpha builds
145+
signingConfigs.release.storeFile = file("../nr-commons.keystore")
146+
signingConfigs.release.storePassword = System.getenv("keystore_password")
147+
signingConfigs.release.keyAlias = System.getenv("key_alias")
148+
signingConfigs.release.keyPassword = System.getenv("key_password")
149+
}
135150

136151
flavorDimensions 'tier'
137152
productFlavors {

nr-commons.keystore.enc

3.83 KB
Binary file not shown.

0 commit comments

Comments
 (0)