-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy_laravel_application.sh
69 lines (55 loc) · 1.75 KB
/
deploy_laravel_application.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
clear
echo "What is the folder name?"
read folderName
echo "Checking folder existence"
if [ -d $folderName ]; then
echo "Removing existent content to clone again"
rm -fr "$folderName/*"
fi
echo "What is the repository name? "
echo "Use GitHub Cli format ( owner/repo_name )"
echo " -- if the owner part was ommited it would be used the current user as owner"
echo " -- to learn more visit https://github.com/cli/cli"
read repoName
echo "Cloning $repoName repository"
gh repo clone $repoName $folderName && cd $folderName
echo "Installing composer and npm dependencies"
composer install && npm install
echo "Cleaning and optimizing application"
php artisan clear-compiled
php artisan optimize:clear
php artisan optimize
echo "Compiling npm assets and production"
npm run production
echo "We will do a rsync deploy? [ Y / N ]"
read doDeploy
if [[ $doDeploy == "Y" ]]; then
echo "What is the remote path to our deploy?"
read remotePath
echo "Starting RSync deploy"
# For more information visit https://explainshell.com/explain?cmd=rsync+-arzu+--human-readable+.%2Fpath%2F*+remotehost%3A%2Fremote%2Fpath
rsync -arzu \
--human-readable \
--exclude '.env.example' \
--exclude '.codeclimate.yml'
--exclude 'docker-compose.yml' \
--exclude '.styleci.yml' \
--exclude '.editorconfig' \
--exclude '*.code-workspace' \
--exclude '.idea' \
--exclude '.env.*' \
--exclude '.git' \
--exclude '.gitattributes' \
--exclude '.github' \
--exclude '.gitignore' \
--exlude '.phpunit.*' \
--exclude '*.sqlite' \
--exclude '*.json' \
--exclude '*.lock' \
--exclude 'tests' \
--exclude 'phpunit.xml' \
--exclude 'node_modules' \
--exclude 'webpack.mix.js' \
./* \
$remotePath
fi