-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.php
102 lines (85 loc) · 2.28 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
namespace Deployer;
require 'recipe/common.php';
// Project name
set('application', '<XXXXXX>');
// Project repository
set('repository', '[email protected]:<XXXXXX>');
// [Optional] Allocate tty for git clone. Default value is false.
set('git_tty', true);
// number of releases
set('keep_releases', 4);
// Shared files/dirs between deploys
set('shared_files', [
'.env',
'web/.htaccess'
]);
set('shared_dirs', [
'web/app/uploads',
'web/app/logs'
]);
// Writable dirs by web server
set('writable_dirs', [
'web/app/uploads',
'web/app/logs'
]);
set('allow_anonymous_stats', false);
// Hosts
host('prod')
->set('hostname', '<XXXXXX>')
->set('remote_user', '<XXXXXX>')
->set('deploy_path', '~/{{application}}')
->set('branch', 'main');
host('test')
->set('hostname', '<XXXXXX>')
->set('remote_user', '<XXXXXXX>')
->set('deploy_path', '~/test-{{application}}')
->set('branch', 'develop')
->set('update_code_strategy', 'clone')
->set('keep_releases', 2);
// activate theme
desc('Activate Theme');
task('wp:theme', function () {
within('{{release_path}}', function () {
// make sure paths use current symlink
run('echo ./vendor/bin/wp option update template_root <XXXXXX>');
run('echo ./vendor/bin/wp option update stylesheet_root <XXXXXX>');
});
});
// flush cache
desc('Flush Cache');
task('wp:cache_flush', function () {
within('{{release_path}}', function () {
// make sure paths use current symlink
run('./vendor/bin/wp cache flush');
});
});
// run wordpress updates
desc('Run WP updates');
task('wp:updates', function () {
within('{{release_path}}', function () {
// make sure paths use current symlink
run('./vendor/bin/wp core update-db');
});
});
// activate wordpress plugins
desc('Activate WP plugins');
task('wp:plugins', function () {
within('{{release_path}}', function () {
// make sure paths use current symlink
run('./vendor/bin/wp plugin activate --all');
});
});
desc('Deploy <XXXXXX>');
task('deploy', [
'deploy:prepare',
'deploy:vendors',
'wp:theme',
'wp:updates',
'wp:plugins',
'wp:cache_flush',
'deploy:publish',
'deploy:success'
]);
// [Optional] If deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');