-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
executable file
·50 lines (40 loc) · 1.21 KB
/
deploy.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
#!/bin/sh
## Check first argument (can either be dev or prod)
if [ -z "$1" ]
then
printf "No argument supplied! (Supply either \"dev\" or \"prod\" \n"
exit 1
else
if [ $1 != "prod" ]
then
if [ $1 != "dev" ]
then
printf "Invalid argument \"$1\" \n"
exit 1
fi
fi
fi
## Set symfony environment variable
export SYMFONY_ENV=$1
## Pull the master branch
printf "Pulling master branch...\n"
git pull origin master
if [ $1 = "prod" ]
then
# composer install takes care of cache cleaning
printf "\n\nComposer install...\n"
composer install --no-dev --optimize-autoloader
printf "\n\Install assets...\n"
php bin/console assets:install
printf "\n\Dump assetic...\n"
php bin/console assetic:dump --env=prod --no-debug
else
printf "\n\nComposer install...\n"
composer install
fi
printf "\n\nUpdating database...\n"
php bin/console doctrine:schema:update --force
printf "\n\nBuilding new optimized class map...\n"
composer dump-autoload --optimize
## Success message
printf "\n\nSuccessfully deployed new version!\n"