-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy path.gitlab-ci.yml
61 lines (56 loc) · 2.08 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "26"
ANDROID_BUILD_TOOLS: "27.0.3"
ANDROID_SDK_TOOLS: "4333796"
APP_NAME: "cafe"
before_script:
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
- wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
- unzip -d android-sdk-linux android-sdk.zip
- echo y | android-sdk-linux/tools/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "platform-tools" >/dev/null
- echo y | android-sdk-linux/tools/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- chmod +x android/gradlew
# temporarily disable checking for EPIPE error and use yes to accept all licenses
- set +o pipefail
- yes | android-sdk-linux/tools/bin/sdkmanager --licenses
- set -o pipefail
- echo $RELEASE_KEYSTORE_BASE64 | base64 --decode > android/app/keystore.jks
# - echo "storeFile=keystore.jks" > android/keystore.properties
# - echo "storePassword=$RELEASE_STORE_PASSWORD" >> android/keystore.properties
# - echo "keyAlias=$RELEASE_KEY_ALIAS" >> android/keystore.properties
# - echo "keyPassword=$RELEASE_KEY_PASSWORD" >> android/keystore.properties
stages:
- build
- package
build_release:
stage: build
only:
- master
script:
- cd android
- ./gradlew assembleRelease
artifacts:
expire_in: 2 hours
paths:
- android/app/build/outputs/
package_release:
before_script:
- export VERSION_NAME=`egrep '^[[:blank:]]+versionName[[:blank:]]' android/app/build.gradle | awk '{print $2}' | sed s/\"//g`
- mkdir -p exported
stage: package
environment: Release
only:
- master
script:
- mv android/app/build/outputs/apk/release/app-release.apk ./exported/${APP_NAME}-v$VERSION_NAME-release.apk
dependencies:
- build_release
artifacts:
expire_in: 2 weeks
paths:
- exported