deployer/recipe/silverstripe.php

71 lines
1.5 KiB
PHP
Raw Normal View History

<?php
2016-11-17 13:26:01 +13:00
namespace Deployer;
require_once __DIR__ . '/common.php';
/**
* Silverstripe configuration
*/
set('shared_assets', function () {
if (test('[ -d {{release_path}}/public ]') || test('[ -d {{deploy_path}}/shared/public ]')) {
return 'public/assets';
}
return 'assets';
});
// Silverstripe shared dirs
set('shared_dirs', [
'{{shared_assets}}'
]);
// Silverstripe writable dirs
set('writable_dirs', [
'{{shared_assets}}'
]);
// Silverstripe cli script
set('silverstripe_cli_script', function () {
$paths = [
'framework/cli-script.php',
'vendor/silverstripe/framework/cli-script.php'
];
foreach ($paths as $path) {
if (test('[ -f {{release_path}}/'.$path.' ]')) {
return $path;
}
}
});
/**
* Helper tasks
*/
task('silverstripe:build', function () {
return run('{{bin/php}} {{release_path}}/{{silverstripe_cli_script}} /dev/build');
})->desc('Run /dev/build');
task('silverstripe:buildflush', function () {
return run('{{bin/php}} {{release_path}}/{{silverstripe_cli_script}} /dev/build flush=all');
})->desc('Run /dev/build?flush=all');
/**
* Main task
*/
task('deploy', [
2017-08-12 12:01:27 +03:00
'deploy:info',
2020-04-25 23:00:08 +03:00
'deploy:setup',
2016-11-05 12:56:53 +07:00
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:vendors',
'deploy:shared',
'deploy:writable',
'silverstripe:buildflush',
'deploy:symlink',
2016-11-05 12:56:53 +07:00
'deploy:unlock',
2020-04-25 23:00:08 +03:00
'deploy:cleanup',
])->desc('Deploy your project');
after('deploy', 'success');