This repository has been archived by the owner on Apr 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
105 lines (96 loc) · 4.55 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
image: openjdk:8-jdk
variables:
ANDROID_COMPILE_SDK: "28"
ANDROID_BUILD_TOOLS: "28.0.3"
ANDROID_SDK_TOOLS: "4333796"
VARIANT: "quickstepLawnchairL3riDevWithWebView"
VARIANT_CAP: "QuickstepLawnchairL3riDevWithWebView"
VARIANTGO: "quickstepLawnchairL3goDevWithWebView"
VARIANTGO_CAP: "QuickstepLawnchairL3goDevWithWebView"
FLAVOUR: "debug"
FLAVOUR_CAP: "Debug"
CHAT_ID: "librechair"
APK_NAME: "librechair-quickstep-lawnchair-l3ri-dev-withWebView-debug"
APK_NAMEGO: "librechair-quickstep-lawnchair-l3go-dev-withWebView-debug"
SECRET_BOT_TOKEN_PLACEHOLDER: "PLA CE HO LDE R"
before_script:
- git submodule update --recursive --init
- apt-get --quiet update --yes
- apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1 screenfetch curl
- screenfetch
- export ANDROID_HOME=$PWD/android-sdk-linux
- export PATH=$PATH:$PWD/android-sdk-linux/platform-tools/
- echo "sdk.dir=$ANDROID_HOME" > local.properties
- echo "sdk-location=$ANDROID_HOME" >> local.properties
- chmod +x ./gradlew
stages:
- build
- sign
- deploy
assemble:
stage: build
script:
- curl -F text="$(git log --oneline | head -n 5)" "https://api.telegram.org/bot${SECRET_BOT_TOKEN}/sendMessage?chat_id=@${CHAT_ID}"
- 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
- set +o pipefail
- yes | android-sdk-linux/tools/bin/sdkmanager --licenses
- set -o pipefail
- ./gradlew assemble${VARIANT_CAP}${FLAVOUR_CAP}
artifacts:
untracked: true
assembleGo:
stage: build
script:
- 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
- set +o pipefail
- yes | android-sdk-linux/tools/bin/sdkmanager --licenses
- set -o pipefail
- ./gradlew assemble${VARIANTGO_CAP}${FLAVOUR_CAP}
artifacts:
untracked: true
signRelease:
stage: sign
dependencies:
- assemble
script:
- mkdir outputs
- echo "${KEYSTORE}" | base64 -d - > Librechair.jks
- jarsigner -keystore Librechair.jks build/outputs/apk/${VARIANT}/${FLAVOUR}/${APK_NAME}.apk -storepass "${KEYSTORE_PASSWORD}" -keypass "${KEY_PASSWORD}" "${KEYSTORE_ALIAS}" --signedjar librechair-ci-signed.apk
- ${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}/zipalign -v 4 librechair-ci-signed.apk outputs/librechair-ci-signed-aligned.apk
artifacts:
paths:
- outputs/librechair-ci-signed-aligned.apk
signReleaseGo:
stage: sign
dependencies:
- assembleGo
script:
- mkdir outputs
- echo "${KEYSTORE}" | base64 -d - > Librechair.jks
- jarsigner -keystore Librechair.jks build/outputs/apk/${VARIANTGO}/${FLAVOUR}/${APK_NAMEGO}.apk -storepass "${KEYSTORE_PASSWORD}" -keypass "${KEY_PASSWORD}" "${KEYSTORE_ALIAS}" --signedjar librechair-ci-signed.apk
- ${ANDROID_HOME}/build-tools/${ANDROID_BUILD_TOOLS}/zipalign -v 4 librechair-ci-signed.apk outputs/librechair-ci-signed-go-aligned.apk
artifacts:
paths:
- outputs/librechair-ci-signed-go-aligned.apk
sendReleaseTelegram:
stage: deploy
script:
- apt-get install curl
- curl -F document=@"outputs/librechair-ci-signed-aligned.apk" "https://api.telegram.org/bot${SECRET_BOT_TOKEN}/sendDocument?chat_id=@${CHAT_ID}"
dependencies:
- signRelease
sendReleaseTelegramGo:
stage: deploy
script:
- apt-get install curl
- curl -F document=@"outputs/librechair-ci-signed-go-aligned.apk" -F text="These are Lawnchair Go builds intended for devices low on resources, such as Android Go devices. If your device is not one of those, or you don't know what this is about, you might be looking for the unlabled builds instead" "https://api.telegram.org/bot${SECRET_BOT_TOKEN}/sendDocument?chat_id=@${CHAT_ID}"
dependencies:
- signReleaseGo