-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·85 lines (82 loc) · 1.64 KB
/
update.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
#!/bin/bash
branch=$1
directory=$2 #/var/www/$repoFolder/
# Notify
echo "---"
echo "Deploy script has been started."
echo "Any unsaved data in the app directory will be overwritten."
echo "If you DO NOT want this, press CTRL + C within 5 seconds."
echo "---"
echo "5"
sleep 1
echo "4"
sleep 1
echo "3"
sleep 1
echo "2"
sleep 1
echo "1"
sleep 1
echo "---"
echo "Deploy script started, please keep this window open during the process."
echo "---"
echo ""
# End notify
# Go to repo directory
cd $directory
echo "Changed directory..."
echo ""
php artisan down
echo "Set laravel in maintenance mode"
echo ""
# Fetch
git fetch
echo "Data fetched..."
echo ""
# Checkout git
git checkout $branch
echo "Checkout $branch"
echo ""
git pull
echo "Pulled latest changes from Git"
echo ""
# Update version number
echo "Updating version number"
git rev-parse HEAD > .version
echo ""
# Install composer dep.
php composer.phar install --no-dev
echo "Composer has been updated"
echo ""
# discover packages
php artisan package:discover
echo "Packages discovered"
echo ""
# migrate
echo "Starting to migrate master database"
php artisan migrate --force
echo "Migration of master-database was successful"
echo ""
sleep 1
# Clear application and view cache
php artisan config:clear
php artisan permission:cache-reset
php artisan cache:clear
php artisan view:clear
echo "Cache cleared..."
echo ""
# NPM production --> Asset compiling
npm ci
npm run production
echo "Assets successfully built in production mode."
echo ""
sleep 1
#up the application
echo "Set laravel in production mode"
echo ""
php artisan up
echo ""
# Closing
echo "---"
echo "Deploy script successfully completed."
echo "---"