-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.php
52 lines (39 loc) · 1.37 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
<?php
namespace Deployer;
require 'recipe/laravel.php';
// Config
set('repository', '[email protected]:IvanBernatovic/collabfinder.git');
add('shared_files', []);
add('shared_dirs', []);
add('writable_dirs', []);
echo 'Deployer path: ' . getenv('DEPLOYER_PATH') . PHP_EOL;
echo 'NPM bin: ' . getenv('NPM_BIN') . PHP_EOL;
// Hosts
host('app.collabfinder.net')
->set('env', [
'NPM_BIN' => getenv('NPM_BIN'),
'DEPLOYER_PATH' => getenv('DEPLOYER_PATH'),
])
->set('remote_user', 'ivan')
->set('deploy_path', getenv('DEPLOYER_PATH') ?: '')
->set('bin/php', '/usr/bin/php7.4')
->set('bin/composer', '/usr/bin/php7.4 /usr/local/bin/composer')
->set('composer_options', '--verbose --prefer-dist --no-progress --no-interaction --no-dev --optimize-autoloader')
->set('bin/npm', getenv('NPM_BIN'));
// Tasks
desc('Install npm packages in CI mode');
task('npm:ci', 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}} ci");
});
task('supervisor:restart', function () {
run('supervisorctl restart "collabfinder-worker:*"');
});
// Hooks
after('deploy:failed', 'deploy:unlock');
after('deploy:vendors', 'npm:ci');
after('deploy:publish', 'supervisor:restart');