This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sh
81 lines (69 loc) · 2.45 KB
/
build.sh
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
#!/bin/bash
doc_fail="https://api.telegram.org/bot$token/sendDocument?chat_id=1773117711"
if [[ $isstable==1 ]]; then # from secrets
chlog="https://api.telegram.org/bot$token/sendMessage?chat_id=$chatid_chlog" # send changelog to the client channel
doc="https://api.telegram.org/bot$token/sendDocument?chat_id=$chatid_release" # send apk to the release apks channel
else
chlog="$msg" # send changelog to the ci channel
doc="https://api.telegram.org/bot$token/sendDocument?chat_id=$chatid" # send apks to the ci channel
fi
msg="https://api.telegram.org/bot$token/sendMessage?chat_id=$chatid"
send_build() { curl -F document=@"$1" "$doc" -F "parse_mode=html" -F caption="$text"; }
build_failed() { curl -F document=@"$1" "$doc_fail" -F "parse_mode=html" -F caption="$text_failed"; }
send_chlog() { curl -F text="$chlog_text" "$chlog" -F "parse_mode=html"; }
send_dew() { curl -F text="$dewider_text" "$msg" -F "parse_mode=html"; }
start=$(date +"%s")
#./gradlew assembleUniversalRelease 2>&1 | tee -a loguni.txt
./gradlew assembleArm64Release 2>&1 | tee -a loga64.txt
./gradlew assembleArm32Release 2>&1 | tee -a loga32.txt
end=$(date +"%s")
bt=$(($end - $start))
#apkuni=$(find app/build/outputs/apk -name '*universal.apk')
apka64=$(find app/build/outputs/apk -name '*arm64-v8a.apk')
apka32=$(find app/build/outputs/apk -name '*armeabi-v7a.apk')
# zip -q9 apk.zip $apk
text_failed="
<b>Build failed )(</b>
<b>$commit</b>
<b>Author:</b> <code>$commit_author</code>
<b>SHA:</b> <code>$commit_sha</code>
<b>Build Time:</b> <code>$(($bt / 60)):$(($bt % 60))</code>
"
textuni="
<b>MD5:</b> <code>$(md5sum $apkuni | cut -d' ' -f1)</code>
"
texta64="
<b>MD5:</b> <code>$(md5sum $apka64 | cut -d' ' -f1)</code>
"
texta32="
<b>MD5:</b> <code>$(md5sum $apka32 | cut -d' ' -f1)</code>
"
if [[ $isstable==1 ]]; then
chlog_text="
<b>New client update is available! Changelog will be published later.</b>
<code>Download:</code> @moex_log
"
else
chlog_text="
<b>$commit</b>
<b>Author:</b> <code>$commit_author</code>
<b>SHA:</b> <code>$commit_sha</code>
<b>Build Time:</b> <code>$(($bt / 60)):$(($bt % 60))</code>
"
fi
dewider_text="~~~~ ~~~~"
if [[ -f $apka64 && -f $apka32 ]]; then
send_dew
#text="$textuni"
#send_build "$apkuni"
text="$texta64"
send_build "$apka64"
text="$texta32"
send_build "$apka32"
send_chlog
else
build_failed loguni.txt
build_failed loga64.txt
build_failed loga32.txt
exit 1
fi