Skip to content

Commit

Permalink
travis build release apk (Fixes #309) (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
rrijal53 authored and dogi committed Jun 19, 2019
1 parent 7a42f59 commit bdf050d
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 56 deletions.
94 changes: 52 additions & 42 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,71 @@ sudo: false
jdk: oraclejdk8
env:
global:
- ANDROID_API=25
- EMULATOR_API=21
- ANDROID_BUILD_TOOLS=25.0.2
- ADB_INSTALL_TIMEOUT=5
- ANDROID_API=25
- EMULATOR_API=21
- ANDROID_BUILD_TOOLS=25.0.2
- ADB_INSTALL_TIMEOUT=5
- TRAVIS_BUILD_NUMBER=$TRAVIS_BUILD_NUMBER
before_install:
- chmod +x gradlew
- yes | sdkmanager "platforms;android-28"
- chmod +x gradlew
- yes | sdkmanager "platforms;android-28"
- openssl aes-256-cbc -K $encrypted_e106cbe777cb_key -iv $encrypted_e106cbe777cb_iv -in treehouses-remote.jks.enc -out treehouses-remote.jks -d
- mkdir "$ANDROID_HOME/licenses" || true
- chmod +x gradlew - yes | sdkmanager "platforms;android-28"
- "./gradlew dependencies || true"
install:
- echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
- echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2"
- echo y | android update sdk -u -a -t tools
- echo y | android update sdk -u -a -t platform-tools
- echo y | android update sdk -u -a -t build-tools-25.0.2
- echo y | android update sdk -u -a -t android-25
- echo y | android update sdk -u -a -t extra-google-m2repository
- echo y | android update sdk -u -a -t extra-android-m2repository
- echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2"
- echo yes | sdkmanager "extras;m2repository;com;android;support;constraint;constraint-layout-solver;1.0.2"
- echo y | android update sdk -u -a -t tools
- echo y | android update sdk -u -a -t platform-tools
- echo y | android update sdk -u -a -t build-tools-25.0.2
- echo y | android update sdk -u -a -t android-25
- echo y | android update sdk -u -a -t extra-google-m2repository
- echo y | android update sdk -u -a -t extra-android-m2repository
before_script:
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
- echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
- emulator -avd test -no-skin -no-audio -no-window &
- android-wait-for-emulator
- adb shell input keyevent 82 &
android:
components:
- tools
- platform-tools
- build-tools-$ANDROID_BUILD_TOOLS
- android-$ANDROID_API
- android-$EMULATOR_API_LEVEL
- extra-google-m2repository
- extra-android-m2repository
- addon-google_apis-google-19
- sys-img-armeabi-v7a-addon-google_apis-google-$ANDROID_API_LEVEL
- sys-img-armeabi-v7a-addon-google_apis-google-$EMULATOR_API_LEVEL
- build-tools-23.0.1
- android-24
- android-23
- android-22
- sys-img-armeabi-v7a-android-22
- extra-android-support
- extra-android-m2repository
- tools
- platform-tools
- build-tools-$ANDROID_BUILD_TOOLS
- android-$ANDROID_API
- android-$EMULATOR_API_LEVEL
- extra-google-m2repository
- extra-android-m2repository
- addon-google_apis-google-19
- sys-img-armeabi-v7a-addon-google_apis-google-$ANDROID_API_LEVEL
- sys-img-armeabi-v7a-addon-google_apis-google-$EMULATOR_API_LEVEL
- build-tools-23.0.1
- android-24
- android-23
- android-22
- sys-img-armeabi-v7a-android-22
- extra-android-support
- extra-android-m2repository
licenses:
- android-sdk-preview-license-.+
- android-sdk-license-.+
- google-gdk-license-.+
- android-sdk-preview-license-.+
- android-sdk-license-.+
- google-gdk-license-.+
after_success:
- sh set_tags.sh
- sh set_tags.sh
before_deploy:
- mv app/build/outputs/apk/debug/remote.apk app/build/outputs/apk/debug/remote-$TRAVIS_BUILD_NUMBER.apk
- sync;sync;sync
- cp $TRAVIS_BUILD_DIR/treehouses-remote.jks $HOME
- cd app/build/outputs/apk/release
- ls
- cp remote-$TRAVIS_BUILD_NUMBER.apk remote.apk
- jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $HOME/treehouses-remote.jks -storepass $storepass -keypass $keypass remote.apk treehouses
- sha256sum remote.apk > remote.apk.sha256
- ls
deploy:
provider: releases
api_key:
secure: F9Rs4BPHf1+O0paanM+I6+3b8NIwUZXvKiT8+SmLAHHXpxkIBYJwKlPROrLyYWKgl2LLpEgU4kZrDo8SORLucwN4kfF5RpyQahcd8eh9db9jdY+Rxad3vbwk3g2X+RNtlb7Y3b0ttaxzWHbCBH+B4stEQzv1rY5X5uS1HeOUW3ekEsqcIhQ3P14MIaNI99P12ycdePx6LAUQnqfEqvIrKgth4maYUGBtKyx9eAlxbMr3qBsXaCpDgqnRImwr+4EYnto+4U9iFc0z+cFa4y4axpi9tl21p4ufaEzy32a7AD3BGlhXaT4sznrjvoxIV9DGKuTczNEqECPNspC8rfJbGbvpHB44CA0jCZxlGo3y5bBFf4PdsxihG1d7SdD9JErWfx0qierj4ueXkdiGZxPO6fMX9o+1TETrR0QnvrD5JIDJggKWVuAr2E2ZybJdO+pFQKA++mxgYjyRaS4otQgc3a/q5ulfwVvEBys7MyIa310vK8X+sbSSp4kcjZTflSaohgczOMc3WAxJRykf0i/S1x8t5SoIrUQ560fj3KF40SPRIzHMQizTFVmA/9W7qEoTPGVkIKlJmmK7D1WEMn0WNHDW9HVeIqRNcEhuOJ0bYST+FYUVPgqvtcDDR8lNMZZMG+gm8nXUfX0E/sfSqP7qrqVhXc5ty5iQfQPSliBL/lE=
file_glob: true
file: app/build/outputs/apk/debug/*
file: ./*
skip-cleanup: true
on:
repo: treehouses/remote
Expand Down
24 changes: 10 additions & 14 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
apply plugin: 'com.android.application'
def appVersionCode = Integer.valueOf(System.env.TRAVIS_BUILD_NUMBER ?: 2)
def appVersionName = (System.env.TRAVIS_BUILD_NUMBER ?: "1.0.0")

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "io.treehouses.remote"
minSdkVersion 15
targetSdkVersion 28
versionCode 2
versionName "2.0"
versionCode appVersionCode
versionName appVersionName+""
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
applicationVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = new File("remote-" + android.defaultConfig.versionCode +".apk")
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
android.applicationVariants.all { variant ->
variant.outputs.all {
// outputFileName = applicationId;
// outputFileName += "-v" + android.defaultConfig.versionName;
// if (variant.buildType.name == "release") {
// outputFileName += ".apk";
// } else {
// outputFileName += "-SNAPSHOT.apk";
// }
outputFileName = "remote.apk"
}
}
}
lintOptions {
abortOnError false
Expand Down
Binary file added treehouses-remote.jks.enc
Binary file not shown.

0 comments on commit bdf050d

Please sign in to comment.