This repository was archived by the owner on Mar 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeploy.php
More file actions
101 lines (83 loc) · 2.22 KB
/
deploy.php
File metadata and controls
101 lines (83 loc) · 2.22 KB
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
<?php
namespace Deployer;
require 'recipe/common.php';
require 'recipe/slack.php';
// Project name
set('application', 'craft-starter');
// Configuration
set('repository', 'git@github.com:Upstatement/craft-starter.git');
set('git_tty', true); // [Optional] Allocate tty for git on first deployment
// Shared files/dirs between deploys
set('shared_files', [
'.env',
'.htaccess'
]);
set('shared_dirs', [
'public/cpresources',
'public/uploads',
'storage/logs',
'storage/runtime',
]);
// TODO: Configure Slack notifications.
// set('slack_webhook', '');
// set('slack_success_color', 'good');
// set('slack_failure_color', 'danger');
// Hosts
inventory('hosts.yml');
set('allow_anonymous_stats', false);
// Tasks
desc('Build static assets locally and upload');
task(
'build',
[
'build:run',
'build:upload',
]
);
desc('Run static assets build script');
task('build:run', function() {
if (getenv('TRAVIS')) {
writeln('<comment>Skipping static build on TravisCI</comment>');
} else {
run(
'export NVM_DIR="$HOME/.nvm"
source "$NVM_DIR/nvm.sh"
nvm install
npm install
npm run build'
);
}
})->local();
desc('Upload built static assets');
task('build:upload', function () {
upload(__DIR__.'/public/static/dist', '{{release_path}}/public/static');
});
desc('Run Craft migrations');
task('craft:migrate', './craft migrate/all --interactive=0');
desc('Sync Craft project configuration');
task('craft:sync_project_config', './craft project-config/sync --interactive=0');
desc('Deploy your project');
task('deploy', [
'deploy:info',
'deploy:prepare',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:writable',
'deploy:vendors',
'build',
'craft:migrate',
'craft:sync_project_config',
'deploy:clear_paths',
'deploy:symlink',
'deploy:unlock',
'cleanup',
'success'
]);
// TODO: Slack notifications on deploy.
// before('deploy', 'slack:notify');
// after('success', 'slack:notify:success');
// after('deploy:failed', 'slack:notify:failure');
// If deploy fails automatically unlock.
after('deploy:failed', 'deploy:unlock');