deployer/recipe/symfony5.php
Anton Medvedev 47a193f9af
Add docgen
2020-10-02 01:11:13 +03:00

57 lines
1.4 KiB
PHP

<?php
namespace Deployer;
require_once __DIR__ . '/common.php';
set('shared_dirs', ['var/log', 'var/sessions']);
set('shared_files', ['.env.local.php', '.env.local']);
set('writable_dirs', ['var']);
set('migrations_config', '');
set('bin/console', function () {
return parse('{{release_path}}/bin/console');
});
set('console_options', function () {
return '--no-interaction';
});
desc('Migrate database');
task('database:migrate', function () {
$options = '--allow-no-migration';
if (get('migrations_config') !== '') {
$options = sprintf('%s --configuration={{release_path}}/{{migrations_config}}', $options);
}
run(sprintf('{{bin/php}} {{bin/console}} doctrine:migrations:migrate %s {{console_options}}', $options));
});
desc('Clear cache');
task('deploy:cache:clear', function () {
run('{{bin/php}} {{bin/console}} cache:clear {{console_options}} --no-warmup');
});
desc('Warm up cache');
task('deploy:cache:warmup', function () {
run('{{bin/php}} {{bin/console}} cache:warmup {{console_options}}');
});
desc('Deploy project');
task('deploy', [
'deploy:info',
'deploy:setup',
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:shared',
'deploy:vendors',
'deploy:writable',
'deploy:cache:clear',
'deploy:cache:warmup',
'deploy:symlink',
'deploy:unlock',
'deploy:cleanup',
]);
after('deploy', 'success');