forked from moeCrafters/moeGramX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
65 lines (55 loc) · 1.96 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
#!/bin/bash
doc_fail="https://api.telegram.org/bot$token/sendDocument?chat_id=1773117711"
doc="https://api.telegram.org/bot$token/sendDocument?chat_id=$chatid" # send apks to the ci channel
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" "$msg" -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 --no-configuration-cache --no-daemon assembleArm64Release 2>&1 | tee -a loga64.txt
./gradlew --no-configuration-cache --no-daemon 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>
"
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>
"
if [[ -f $apka64 && -f $apka32 ]]; then
#text="$textuni"
#send_build "$apkuni"
send_dew
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