-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
57 lines (46 loc) · 1.53 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
#! /bin/sh
project="[phonegap projectnumber]";
username="[phonegap username]";
password="[phonegap password]";
appPath="[path to www folder]";
projectPath="[path where you want the apk file]";
APIPATH="https://build.phonegap.com/api/v1/apps";
FILEPATH="https://build.phonegap.com/apps/";
APIcall="$APIPATH/$project"
creds="$username:$password";
##commit changes
echo "Forcing changes to github";
cd $appPath
null=$(git commit -m "auto commit as part of script");
null=$(git push origin master);
echo "Done";
cd $projectPath
##Request Phonegap data
echo "Requesting Project Data.";
package=$(curl -s -u $creds $APIcall | grep -Po '"package":.*?[^\\],');
title=$(curl -s -u $creds $APIcall | grep -Po '"title":.*?[^\\],');
title=${title##*:};
title=$(echo $title|sed 's/,//g');
title=$(echo $title|sed 's/"//g');
package=${package##*:};
package=$(echo $package|sed 's/,//g');
package=$(echo $package|sed 's/"//g');
echo "Done. ";
##Request Rebuild
echo "Requesting Rebuild.";
request=$(curl -s -u $creds -X PUT -d 'data={"pull":"true"}' $APIcall);
echo "Done. ";
donecheck="";
echo "\nWaiting for rebuild to be done.";
while [$donecheck -eq ""]
do
echo ".";
sleep 10;
donecheck=$(curl -s -u $creds $APIcall | grep -Po '"android":"complete"');
done
echo "Done. Now downloading.\n";
##Download File
download=$(curl -L -s -u $creds -o $title-debug.apk $FILEPATH/$project/download/android);
##Install on Device
~/Downloads/android-sdk/platform-tools/adb uninstall $package
~/Downloads/android-sdk/platform-tools/adb install -r ./$title-debug.apk