forked from harshpreets63/Mirror-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheroku_push.sh
114 lines (114 loc) · 2.73 KB
/
heroku_push.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#bin/bash
appname=elephant$RANDOM
if ! command -v heroku
then
echo "Heroku could not be found"
exit
fi
echo "Are You Logged In On Heroku CLi? Type Y OR N."
read login
if ! ( [ "$login" == "Y" ] || [ "$login" == "y" ] )
then
echo "Login First"
exit
fi
echo "Passing Fake Git UserName"
git config --global user.name Your Name
git config --global user.email [email protected]
echo "1. Type 1 If You Want To Host A New Bot."
echo "2. Type 2 If You Want To Update Old Bot."
read update
if ! [ "$update" == "2" ]
then
echo "Hosting A New Bot"
if ! [ -f config.env ]
then
echo "Config Not Found"
exit
fi
echo -e "Making a New App\n"
echo -e "Want To Enter Your Own App Name? (Random Name:-$appname Will Be Selected By Default.)\n"
echo -e "Enter An Unique App Name Starting With Lowercase Letter.\n"
echo -e "Dont Enter Anything For Random App Name.(Just Press Enter And Leave It Blank.)\n"
read name
name="${name:=$appname}"
appname=$name
clear
echo -e "Choose The Server Region\n"
echo -e "Enter 1 For US\nEnter 2 For EU\n\nJust Press Enter For US Region(Default)"
read region
region="${region:=1}"
if [ $region == 1 ]
then
region=us
elif [ $region == 2 ]
then
region=eu
else
echo -e "Wrong Input Detected"
echo -e "US Server Is Selected"
region=us
fi
echo "Using $appname As Name."
echo "Using $region As Region For The Bot."
heroku create --region $region $appname
heroku git:remote -a $appname
heroku stack:set container -a $appname
echo "Done"
echo "Pushing"
if ! [ -d accounts/ ]
then
git add .
git add -f token.pickle config.env drive_folder
git commit -m "changes"
git push heroku
else
echo "Pushing Accounts Folder Too"
git add .
git add -f token.pickle config.env drive_folder accounts accounts/*
git commit -m "changes"
git push heroku
fi
clear
echo "Avoiding suspension."
heroku apps:destroy --confirm $appname
heroku create --region $region $appname
heroku git:remote -a $appname
heroku stack:set container -a $appname
echo "Done"
echo "Pushing"
if ! [ -d accounts/ ]
then
git add .
git add -f token.pickle config.env drive_folder
git commit -m "changes"
git push heroku
else
echo "Pushing Accounts Folder Too"
git add .
git add -f token.pickle config.env drive_folder accounts accounts/*
git commit -m "changes"
git push heroku
fi
heroku ps:scale worker=0 -a $appname
heroku ps:scale worker=1 -a $appname
echo "Done"
echo "Enjoy"
else
echo "Updating Bot."
git add .
if [ -d accounts/ ]
then
git add -f token.pickle config.env drive_folder accounts accounts/*
git commit -m "changes"
git push heroku
else
git add -f token.pickle config.env drive_folder
git commit -m "changes"
git push heroku
fi
fi
echo "Done"
echo "Type"
echo "heroku logs -t"
echo "To Check Bot Logs Here."