'--no-interaction'); set('bin/console', fn() => parse('{{release_path}}/bin/console')); // Hosts host('snips.loken.nl') ->setRemoteUser('www-data') ->set('branch', function () { return input()->getOption('branch') ?: 'master'; }) ->set('deploy_path', '~/snips.loken.nl') ; desc('Clear cache'); task('cache:clear', fn() => run('{{bin/php}} {{bin/console}} cache:clear {{console_options}} --no-warmup')); desc('Warm up cache'); task('cache:warmup', fn() => run('{{bin/php}} {{bin/console}} cache:warmup {{console_options}}')); 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('Shows current deployed version'); task('deploy:current', function () { $current = run('readlink {{deploy_path}}/current'); writeln("Current deployed version: $current"); }); desc('Deploy project'); task('deploy', [ 'deploy:prepare', 'deploy:vendors', 'cache:clear', 'cache:warmup', 'database:migrate', 'deployment:log', 'deploy:symlink', 'deploy:unlock', 'deploy:cleanup', 'deploy:current', ]); after('deploy', 'deploy:success'); after('deploy:failed', 'deploy:unlock');