-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.php
59 lines (45 loc) · 1.46 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
<?php
declare(strict_types=1);
namespace Deployer;
require 'recipe/symfony.php';
// Config
set('repository', 'git@github.com:arnaud-ritti/symfony-demo.git');
set('git_tty', false);
set('ssh_multiplexing', false);
set('shared_dirs', [
'var/bins',
'var/log',
]);
set('shared_files', [
'.env.local',
]);
set('writable_dirs', [
'var',
'var/bins',
'var/cache',
'var/log',
'var/sessions',
]);
// Hosts
import('inventory.yaml');
task('dotenv:set-env', static function (): void {
run('rm {{release_path}}/.env.local');
run('touch {{release_path}}/.env.local');
run('echo "APP_ENV={{symfony_env}}" >> {{release_path}}/.env.local');
run('echo "SERVICE_ACCOUNT_PASSWORD={{service_account_password}}" >> {{release_path}}/.env.local');
run('echo "BUCKET_MODE={{bucket_mode}}" >> {{release_path}}/.env.local');
});
// Tasks
task('npm:build', static function (): void {
runLocally('npm run build');
upload('public/build/', '{{release_path}}/public/build/');
run('cd {{release_or_current_path}} && {{bin/console}} cache:clear {{console_options}}');
});
task('database:fixture', static function (): void {
run('cd {{release_or_current_path}} && {{bin/console}} doctrine:fixtures:load {{console_options}}');
});
before('deploy:symlink', 'npm:build');
before('deploy:symlink', 'database:migrate');
after('database:migrate', 'database:fixture');
after('database:fixture', 'dotenv:set-env');
after('deploy:failed', 'deploy:unlock');