This repository was archived by the owner on Nov 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdeploy.php
74 lines (50 loc) · 1.83 KB
/
deploy.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
namespace Deployer;
require 'recipe/laravel.php';
// Project name
set('application', 'my_project');
// Project repository
set('repository', '[email protected]:michielgerritsen/TALL-Magento.git');
set('composer_options', '{{composer_action}} --verbose --prefer-dist --no-progress --no-interaction --optimize-autoloader --no-suggest');
// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true);
// Shared files/dirs between deploys
add('shared_files', []);
add('shared_dirs', []);
// Writable dirs by web server
add('writable_dirs', []);
set('allow_anonymous_stats', false);
// Hosts
inventory('hosts.yml');
// Tasks
task('build', function () {
run('cd {{release_path}} && build');
});
// [Optional] if deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');
desc('Copy assets data');
task('assets:upload', function () {
runLocally('npm run production');
writeln('Compiled assets');
upload('public/js/', '{{release_path}}/public/js/');
writeln('Uploaded public/js/');
upload('public/css/', '{{release_path}}/public/css/');
writeln('Uploaded public/css/');
// upload('public/fonts/', '{{release_path}}/public/fonts/');
// writeln('Uploaded public/fonts/');
// upload('public/images/', '{{release_path}}/public/images/');
// writeln('Uploaded public/images/');
// upload('public/vendor/', '{{release_path}}/public/vendor/');
// writeln('Uploaded public/vendor/');
});
after('deploy:writable', 'assets:upload');
desc('Restart php-fpm');
task('php-fpm:restart', function () {
run('sudo service php7.4-fpm reload');
});
after('deploy:symlink', 'php-fpm:restart');
desc('Flush Laravel cache');
task('artisan:cache:clear', function () {
run('cd {{release_path}} && {{bin/php}} artisan cache:clear');
});
after('deploy:symlink', 'artisan:cache:clear');