-
Notifications
You must be signed in to change notification settings - Fork 0
/
Envoy.blade.php
54 lines (48 loc) · 1.13 KB
/
Envoy.blade.php
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
@setup
$server = "142.93.130.220";
$project = "geekrunners.knapenkjell.com";
$repo = "git@github.com:kjellknapen/geekrunners.git";
$branch = "master";
$userAndServer = 'deploybot@'. $server;
$baseDir = "/home/deploybot/{$project}";
function logMessage($message) {
return "echo '\033[32m" .$message. "\033[0m';\n";
}
@endsetup
@servers(['local' => '127.0.0.1', 'remote' => $userAndServer])
@story('deploy')
pushLocal
checkRepo
deployment
@endstory
@task('pushLocal',['on' => 'local'])
{{ logMessage("Pushing to git...") }}
git add .
git commit -m "{{ $commit }}"
git push
@endtask
@task('checkRepo',['on' => 'remote'])
{{ logMessage("Checking repository...") }}
if [ ! -d {{ $baseDir }} ]
then
git clone {{ $repo }} {{ $project }}
cd {{ $baseDir }}
git checkout {{ $branch }}
chmod 770 -R {{ $baseDir }}/storage
fi
@endtask
@task('deployment',['on' => 'remote'])
{{ logMessage("💻 Deploying code changes...") }}
cd {{ $baseDir }}
git stash
git pull
composer install
yarn
yarn run prod
php artisan config:clear
php artisan migrate --force
php artisan cache:clear
php artisan config:cache
php artisan config:clear
sudo apachectl restart
@endtask