forked from Ayctor/wp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.php
56 lines (48 loc) · 1.3 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
<?php
namespace Deployer;
require 'recipe/composer.php';
// Configuration
set('ssh_type', 'native');
set('repository', 'git@bitbucket.org:ayctor/cwpt.git');
set('shared_files', [
'.env'
]);
set('shared_dirs', [
'mu-plugins'
]);
set('writable_dirs', []);
// Servers
host('rec.es1')
->stage('recette')
->set('deploy_path', '/home/websites/deployer/');
// Tasks
set('bin/npm', function () {
return run('which npm');
});
desc('Install npm packages');
task('npm:install', function () {
if (has('previous_release')) {
if (test('[ -d {{previous_release}}/node_modules ]')) {
run('cp -R {{previous_release}}/node_modules {{release_path}}');
}
}
run("cd {{release_path}} && {{bin/npm}} install");
});
after('deploy:update_code', 'npm:install');
desc('Build assets');
task('npm:build', function () {
run("cd {{release_path}} && {{bin/npm}} run production");
});
after('npm:install', 'npm:build');
desc('Build svg sprite');
task('npm:sprite', function () {
run("cd {{release_path}} && {{bin/npm}} run svg");
});
after('npm:install', 'npm:sprite');
// set('bin/wp', function () {
// return run('which wp');
// });
// task('reset:opcache', function () {
// run('cd {{release_path}} && {{bin/wp}} reset opcache');
// });
// after('deploy', 'reset:opcache');