forked from WireGuard/wireguard-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dronebuild
43 lines (34 loc) · 1.8 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
#!/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/SensiPeeps/WireGuardX/commit/"
DRONE_URL="https://cloud.drone.io/SensiPeeps/WireGuardX/"
echo "sdk.dir=${ANDROID_HOME}" > local.properties
git clone https://github.com/WireGuard/wireguard-tools.git tunnel/tools/wireguard-tools/.
curl -s -X POST "https://api.telegram.org/bot${TG_BOT_API}/sendMessage" -d chat_id="-1001142276906" \
-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/SensiPeeps/app_keystores -b master
mv app_keystores/sensipeeps_release.jks .
mv app_keystores/sp_wg_keystore.properties keystore.properties
./gradlew assembleRelease
if [ -f ui/build/outputs/apk/release/ui-release.apk ]; then
cp ui/build/outputs/apk/release/ui-release.apk ui/build/outputs/apk/release/WireGuardX-${DATE}.apk
cd ui/build/outputs/apk/release/
APK=$(echo WireGuardX-*.apk)
SHA256=$(sha256sum ${APK} | cut -d' ' -f1)
curl -F document=@"${APK}" "https://api.telegram.org/bot${TG_BOT_API}/sendDocument" \
-F chat_id="-1001142276906" \
-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 ui/build/outputs/apk
else
curl -s -X POST "https://api.telegram.org/bot${TG_BOT_API}/sendMessage" -d chat_id="-1001142276906" \
-d "disable_web_page_preview=true" \
-d "parse_mode=html" \
-d text="❌ <b>Build error, exiting now!</b>"
fi