-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdronebuild
47 lines (37 loc) · 1.95 KB
/
dronebuild
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
#!/bin/bash
ANDROID_HOME="/opt/android-sdk"
export TZ=Asia/Kolkata
DATE="`date +%d%m%Y-%H%M%S`"
HEAD_COMMIT="$(git rev-parse HEAD)"
GITHUB_URL="https://github.com/theradcolor/TweaksKM/commit/"
DRONE_URL="https://cloud.drone.io/theradcolor/TweaksKM/"
echo "sdk.dir=${ANDROID_HOME}" > local.properties
curl -s -X POST "https://api.telegram.org/bot${TG_BOT_API}/sendMessage" -d chat_id="-1001365210159" \
-d "disable_web_page_preview=true" \
-d "parse_mode=markdownV2" \
-d text="⚒️ [*Building*](${DRONE_URL}${DRONE_BUILD_NUMBER}) with HEAD as [*$(echo $HEAD_COMMIT | cut -c1-8)*](${GITHUB_URL}${HEAD_COMMIT}) ⚒️"
git clone https://theradcolor:${GITHUB_TOKEN}@github.com/theradcolor/app-keystores -b master
mv app-keystores/theradcolor.jks .
mv app-keystores/theradcolor_keystore.properties keystore.properties
export JOBS="$((`grep -c '^processor' /proc/cpuinfo`))"
echo "org.gradle.daemon=true" >> local.properties
echo "org.gradle.parallel=true" >> local.properties
echo "org.gradle.workers.max=${JOBS}" >> local.properties
./gradlew assembleRelease --parallel --max-workers=${JOBS}
if [ -f app/build/outputs/apk/release/app-release.apk ]; then
cp app/build/outputs/apk/release/app-release.apk app/build/outputs/apk/release/TweaksKM-${DATE}.apk
cd app/build/outputs/apk/release/
APK=$(echo TweaksKM-*.apk)
SHA256=$(sha256sum ${APK} | cut -d' ' -f1)
curl --progress-bar -F document=@"${APK}" "https://api.telegram.org/bot${TG_BOT_API}/sendDocument" \
-F chat_id="-1001365210159" \
-F "disable_web_page_preview=true" \
-F "parse_mode=html" \
-F caption="⭕️ <b>CI build completed successfully</b> | <b>SHA256 checksum</b> • <code>${SHA256}</code>"
rm -rf app/build/outputs/apk
else
curl -s -X POST "https://api.telegram.org/bot${TG_BOT_API}/sendMessage" -d chat_id="-1001365210159" \
-d "disable_web_page_preview=true" \
-d "parse_mode=html" \
-d text="❌ <b>Build error, exiting now!</b>"
fi