forked from jonathanpmartins/ubuntusetup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaravel-deploy-script.sh
76 lines (60 loc) · 1.57 KB
/
laravel-deploy-script.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
#!/bin/bash
echo '********** Preparing Deploy to Develop Branch *********';
STRING="cd /var/www/app; sudo chmod -R 777 storage; sudo chown -R www-data:adm storage/;"
ask() {
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
default=Y
elif [ "${2:-}" = "N" ]; then
prompt="y/N"
default=N
else
prompt="y/n"
default=
fi
read -p "$1 [$prompt] " REPLY
if [ -z "$REPLY" ]; then
REPLY=$default
fi
case "$REPLY" in
Y*|y*) return 0 ;;
N*|n*) return 1 ;;
esac
done
}
setPull() {
STRING="$STRING git pull; git checkout develop; composer dump-autoload;"
}
setMigrationReset() {
STRING="$STRING php artisan migrate:reset;"
}
setMigration() {
STRING="$STRING php artisan migrate --seed;"
}
if ask "Refresh database?" y; then
setMigrationReset
setPull
setMigration
else
if ask "Migrate database?" y; then
setPull
setMigration
else
setPull
fi
fi
if ask "composer update?" y; then
STRING="$STRING composer update; git checkout composer.lock;"
fi
if ask "bower update?" y; then
STRING="$STRING bower update;"
fi
if ask "gulp?" y; then
STRING="$STRING gulp --production;"
fi
STRING="$STRING php artisan optimize; php artisan route:scan; php artisan route:cache;"
ssh myServer "$STRING";
echo '***************************** String *****************************';
echo $STRING;
echo '***************************** String *****************************';