-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.php
53 lines (43 loc) · 1.11 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
<?php
namespace Deployer;
require 'recipe/symfony4.php';
require 'vendor/deployer/recipes/recipe/npm.php';
// Project repository
set('repository', '[email protected]:Cryde/php-vote.git');
// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true);
set('keep_releases', 1);
set('ssh_multiplexing', true);
// Hosts
inventory('hosts.yml');
// Tasks
task('npm:ci', function () {
run("cd {{release_path}} && {{bin/npm}} ci");
});
desc('Build assets');
task(
'assets:build',
function () {
run('cd {{release_path}} && {{bin/npm}} run build');
}
);
after('npm:ci', 'assets:build');
desc('Remove node_modules folder');
task(
'assets:clean',
function () {
run('cd {{release_path}} && rm -rf node_modules');
}
);
after('deploy:symlink', 'assets:clean');
desc('Restart PHP-FPM service');
task(
'php-fpm:restart',
function () {
run('sudo service php7.4-fpm reload');
}
);
after('deploy:symlink', 'php-fpm:restart');
// Migrate database before symlink new release.
before('deploy:symlink', 'database:migrate');
after('deploy:update_code', 'npm:ci');