-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
68 lines (58 loc) · 3.1 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
62
63
64
65
66
67
68
image: openjdk:8-jdk #Defining the Docker Image
variables:
ANDROID_COMPILE_SDK: "28" #set compile SDK version
ANDROID_BUILD_TOOLS: "28.0.2" #set build tool version
ANDROID_SDK_TOOLS: "4333796" #set SDK tool build number you can find yous here https://developer.android.com/studio/releases/sdk-tools
before_script:
#Read CICD Vars in a file
- "echo { > android/app/globalSettings.json"
- 'echo \"PLAY_STORE_UPLOAD_KEYSTORE_ALIAS\": \"$PLAY_STORE_UPLOAD_KEYSTORE_ALIAS\", >> android/app/globalSettings.json'
- 'echo \"PLAY_STORE_UPLOAD_KEYSTORE_PASSWORD\": \"$PLAY_STORE_UPLOAD_KEYSTORE_PASSWORD\", >> android/app/globalSettings.json'
- 'echo \"PLAY_STORE_UPLOAD_KEY_PASSWORD\": \"$PLAY_STORE_UPLOAD_KEY_PASSWORD\", >> android/app/globalSettings.json'
- 'echo \"GCP_PLAYSTORE_SERIVCE_ACCOUNT_EMAIL\": \"$PLAY_STORE_SERVICE_ACCOUNT_EMAIL\", >> android/app/globalSettings.json'
- "echo } >> android/app/globalSettings.json"
- cat android/app/globalSettings.json
- "echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p"
# Output Playstore Service Account Key JSON to a runtime JSON file
- "echo $GCP_PLAYSTORE_SERIVCE_ACCOUNT_KEY_JSON > android/app/serviceAccess.json"
- cat android/app/serviceAccess.json
#Installing Packages
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
# Adding the NodeSource APT repository for Debian-based distributions repository AND the PGP key for verifying packages
- curl -sL https://deb.nodesource.com/setup_12.x | bash -
# Install Node.js from the Debian-based distributions repository
- apt-get install -y nodejs && curl -L https://www.npmjs.com/install.sh | sh
# - npm install -g npx
- npm install -g yarn
- yarn install
# - yarn run build
#Installing the Android SDK
- 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
#Setting up the environment variable
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- chmod +x * # gradlew #set executable permission
# temporarily disable checking for EPIPE error and use yes to accept all licenses
- set +o pipefail
- yes | android-sdk-linux/tools/bin/sdkmanager --licenses # accept SDK licences
- set -o pipefail
# - build_release_android
stages:
- build_release_android
build_release_android:
cache: {}
stage: build_release_android
tags:
- appbuild
script:
- base64 -d $PLAY_STORE_UPLOAD_KEYSTORE_FILE_BASE64 > android/app/uploadRelease.keystore
- cd android
- ./gradlew bundleRelease
# - ./gradlew publishApkRelease # command to publish app on play store
only:
- development #set trigger for CICD if push or merge in master branch