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 () {
|
|
|
|
$paths = [
|
|
|
|
'assets',
|
|
|
|
'public/assets'
|
|
|
|
];
|
|
|
|
foreach ($paths as $path) {
|
|
|
|
if (test('[ -d {{release_path}}/'.$path.' ]')) {
|
|
|
|
return $path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
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',
|
2016-06-27 04:25:23 +12:00
|
|
|
'deploy:prepare',
|
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',
|
2016-06-27 04:25:23 +12:00
|
|
|
'cleanup',
|
|
|
|
])->desc('Deploy your project');
|
|
|
|
|
|
|
|
after('deploy', 'success');
|