Skip to content

Commit

Permalink
chore: Update build.sh
Browse files Browse the repository at this point in the history
Add an optional parameter to disable configuration cache
  • Loading branch information
jplie authored Nov 13, 2023
1 parent cbfcb05 commit 0559fff
Showing 1 changed file with 12 additions and 28 deletions.
40 changes: 12 additions & 28 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
#!/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
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" "$chlog" -F "parse_mode=html"; }
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 assembleArm64Release 2>&1 | tee -a loga64.txt
./gradlew assembleArm32Release 2>&1 | tee -a loga32.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')
Expand Down Expand Up @@ -47,34 +41,24 @@ texta64="
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="~~~~ ~~~~"
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
send_dew
#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 loguni.txt
build_failed loga64.txt
build_failed loga32.txt
exit 1
Expand Down

0 comments on commit 0559fff

Please sign in to comment.