2016-06-27 04:25:23 +12:00
|
|
|
<?php
|
2016-11-17 13:26:01 +13:00
|
|
|
namespace Deployer;
|
|
|
|
|
2016-06-27 04:25:23 +12:00
|
|
|
require_once __DIR__ . '/common.php';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Silverstripe configuration
|
|
|
|
*/
|
|
|
|
|
2019-10-21 18:58:24 +13:00
|
|
|
set('shared_assets', function () {
|
2020-01-29 00:13:11 -08:00
|
|
|
if (test('[ -d {{release_path}}/public ]') || test('[ -d {{deploy_path}}/shared/public ]')) {
|
|
|
|
return 'public/assets';
|
2019-10-21 18:58:24 +13:00
|
|
|
}
|
2020-01-29 00:13:11 -08:00
|
|
|
return 'assets';
|
2019-10-21 18:58:24 +13:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2016-06-27 04:25:23 +12:00
|
|
|
// Silverstripe shared dirs
|
|
|
|
set('shared_dirs', [
|
2019-10-21 18:58:24 +13:00
|
|
|
'{{shared_assets}}'
|
2016-06-27 04:25:23 +12:00
|
|
|
]);
|
|
|
|
|
|
|
|
// Silverstripe writable dirs
|
2019-10-21 18:58:24 +13:00
|
|
|
set('writable_dirs', [
|
|
|
|
'{{shared_assets}}'
|
|
|
|
]);
|
2016-06-27 04:25:23 +12:00
|
|
|
|
2018-01-11 17:47:05 +13:00
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2016-06-27 04:25:23 +12:00
|
|
|
/**
|
|
|
|
* Helper tasks
|
|
|
|
*/
|
|
|
|
task('silverstripe:build', function () {
|
2018-01-11 17:47:05 +13:00
|
|
|
return run('{{bin/php}} {{release_path}}/{{silverstripe_cli_script}} /dev/build');
|
2016-06-27 04:25:23 +12:00
|
|
|
})->desc('Run /dev/build');
|
|
|
|
|
|
|
|
task('silverstripe:buildflush', function () {
|
2018-01-11 17:47:05 +13:00
|
|
|
return run('{{bin/php}} {{release_path}}/{{silverstripe_cli_script}} /dev/build flush=all');
|
2016-06-27 04:25:23 +12:00
|
|
|
})->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',
|
2016-06-27 04:25:23 +12:00
|
|
|
'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',
|
2016-06-27 04:25:23 +12:00
|
|
|
])->desc('Deploy your project');
|
|
|
|
|
|
|
|
after('deploy', 'success');
|