forked from JarlPenguin/releases
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·93 lines (81 loc) · 3.95 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
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
export outdir="${ROM_DIR}/out/target/product/${device}"
BUILD_START=$(date +"%s")
echo "Build started for ${device}"
if [ "${jenkins}" == "true" ]; then
telegram -M "Build ${BUILD_DISPLAY_NAME} started for ${device}: [See Progress](${BUILD_URL}console)"
else
telegram -M "Build started for ${device}"
fi
source build/envsetup.sh
source "${my_dir}/config.sh"
if [ "${official}" == "true" ]; then
export CUSTOM_BUILD_TYPE="OFFICIAL"
fi
if [ -z "${buildtype}" ]; then
export buildtype="userdebug"
fi
if [ "${ccache}" == "true" ] && [ -n "${ccache_size}" ]; then
export USE_CCACHE=1
ccache -M "${ccache_size}G"
elif [ "${ccache}" == "true" ] && [ -z "${ccache_size}" ]; then
echo "Please set the ccache_size variable in your config."
exit 1
fi
if [ -n "${sf_target}" ] && [ -z "${sf_http_target}" ]; then
echo "Please set the sf_http_target variable in your config."
exit 1
fi
lunch "${rom_vendor_name}_${device}-${buildtype}"
rm "${outdir}"/*2021*.zip
rm "${outdir}"/*2021*.zip.md5
if [ "${clean}" == "clean" ]; then
mka clean
mka clobber
elif [ "${clean}" == "installclean" ]; then
mka installclean
fi
mka "${bacon}"
BUILD_END=$(date +"%s")
BUILD_DIFF=$((BUILD_END - BUILD_START))
export finalzip_path=$(ls "${outdir}"/*2021*.zip | tail -n -1)
if [ "${upload_recovery}" == "true" ]; then
export img_path=$(ls "${outdir}"/recovery.img | tail -n -1)
fi
export zip_name=$(echo "${finalzip_path}" | sed "s|${outdir}/||")
export tag=$( echo "${zip_name}-$(date +%H%M)" | sed 's|.zip||')
if [ -e "${finalzip_path}" ]; then
echo "Build completed successfully in $((BUILD_DIFF / 60)) minute(s) and $((BUILD_DIFF % 60)) seconds"
echo "Uploading"
[[ -n "${sf_target}" ]] && scp "${finalzip_path}" "${sf_target}"
github-release "${release_repo}" "${tag}" "master" "${ROM} for ${device}
Date: $(env TZ="${timezone}" date)" "${finalzip_path}"
if [ "${upload_recovery}" == "true" ]; then
if [ -e "${img_path}" ]; then
github-release "${release_repo}" "${tag}" "master" "${ROM} for ${device}
Date: $(env TZ="${timezone}" date)" "${img_path}"
else
echo "Build failed in $((BUILD_DIFF / 60)) minute(s) and $((BUILD_DIFF % 60)) seconds"
telegram -N -M "Build failed in $((BUILD_DIFF / 60)) minute(s) and $((BUILD_DIFF % 60)) seconds"
curl --data parse_mode=HTML --data chat_id=$TELEGRAM_CHAT --data sticker=CAADBQADGgEAAixuhBPbSa3YLUZ8DBYE --request POST https://api.telegram.org/bot$TELEGRAM_TOKEN/sendSticker
exit 1
fi
fi
echo "Uploaded"
[[ -n "${sf_target}" ]] && sf_text_result="
Download ROM via Sourceforge: ["${zip_name}"]("https://sourceforge.net/projects/${sf_http_target}/${zip_name}/download")"
if [ "${upload_recovery}" == "true" ]; then
telegram -M "Build completed successfully in $((BUILD_DIFF / 60)) minute(s) and $((BUILD_DIFF % 60)) seconds
Download ROM via GitHub: ["${zip_name}"]("https://github.com/${release_repo}/releases/download/${tag}/${zip_name}")${sf_text_result}
Download recovery via GitHub: ["recovery.img"]("https://github.com/${release_repo}/releases/download/${tag}/recovery.img")"
else
telegram -M "Build completed successfully in $((BUILD_DIFF / 60)) minute(s) and $((BUILD_DIFF % 60)) seconds
Download ROM via GitHub: ["${zip_name}"]("https://github.com/${release_repo}/releases/download/${tag}/${zip_name}")${sf_text_result}"
fi
curl --data parse_mode=HTML --data chat_id=$TELEGRAM_CHAT --data sticker=CAADBQADGgEAAixuhBPbSa3YLUZ8DBYE --request POST https://api.telegram.org/bot$TELEGRAM_TOKEN/sendSticker
else
echo "Build failed in $((BUILD_DIFF / 60)) minute(s) and $((BUILD_DIFF % 60)) seconds"
telegram -N -M "Build failed in $((BUILD_DIFF / 60)) minute(s) and $((BUILD_DIFF % 60)) seconds"
curl --data parse_mode=HTML --data chat_id=$TELEGRAM_CHAT --data sticker=CAADBQADGgEAAixuhBPbSa3YLUZ8DBYE --request POST https://api.telegram.org/bot$TELEGRAM_TOKEN/sendSticker
exit 1
fi