2016-11-19 15:13:32 +07:00
|
|
|
<?php
|
|
|
|
namespace Deployer;
|
|
|
|
|
2021-10-18 18:29:14 +02:00
|
|
|
// Use mv -T if available. Will check automatically.
|
|
|
|
set('use_atomic_symlink', function () {
|
|
|
|
return commandSupportsOption('mv', '--no-target-directory');
|
|
|
|
});
|
|
|
|
|
2021-11-08 22:59:39 +01:00
|
|
|
desc('Creates symlink to release');
|
2016-11-19 15:13:32 +07:00
|
|
|
task('deploy:symlink', function () {
|
2017-03-13 15:13:34 +07:00
|
|
|
if (get('use_atomic_symlink')) {
|
2020-10-09 01:35:42 +02:00
|
|
|
run("mv -T {{deploy_path}}/release {{current_path}}");
|
2016-11-19 15:13:32 +07:00
|
|
|
} else {
|
|
|
|
// Atomic symlink does not supported.
|
2021-09-24 15:19:15 +02:00
|
|
|
// Will use simple two steps switch.
|
2016-11-19 15:13:32 +07:00
|
|
|
|
2020-10-09 01:35:42 +02:00
|
|
|
run("cd {{deploy_path}} && {{bin/symlink}} {{release_path}} {{current_path}}"); // Atomic override symlink.
|
2016-11-19 15:13:32 +07:00
|
|
|
run("cd {{deploy_path}} && rm release"); // Remove release link.
|
|
|
|
}
|
|
|
|
});
|