2017-08-12 11:56:35 +03:00
|
|
|
<?php
|
|
|
|
namespace Deployer;
|
|
|
|
|
2020-10-09 02:24:09 +02:00
|
|
|
// Holds name of deployed branch, tag or revision.
|
2020-10-28 00:12:18 +01:00
|
|
|
set('target', function () {
|
2020-10-09 02:24:09 +02:00
|
|
|
$t = '';
|
|
|
|
$branch = get('branch');
|
|
|
|
if (!empty($branch)) {
|
|
|
|
$t = $branch;
|
|
|
|
}
|
|
|
|
if (input()->hasOption('tag') && !empty(input()->getOption('tag'))) {
|
|
|
|
$t = input()->getOption('tag');
|
|
|
|
}
|
|
|
|
if (input()->hasOption('revision') && !empty(input()->getOption('revision'))) {
|
|
|
|
$t = input()->getOption('revision');
|
|
|
|
}
|
|
|
|
if (empty($t)) {
|
|
|
|
$t = "HEAD";
|
|
|
|
}
|
|
|
|
return $t;
|
|
|
|
});
|
|
|
|
|
2017-08-12 11:56:35 +03:00
|
|
|
task('deploy:info', function () {
|
|
|
|
$what = '';
|
|
|
|
$branch = get('branch');
|
|
|
|
|
|
|
|
if (!empty($branch)) {
|
2020-04-25 23:00:08 +03:00
|
|
|
$what = "<fg=magenta;options=bold>$branch</>";
|
2017-08-12 11:56:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (input()->hasOption('tag') && !empty(input()->getOption('tag'))) {
|
|
|
|
$tag = input()->getOption('tag');
|
2020-04-25 23:00:08 +03:00
|
|
|
$what = "tag <fg=magenta;options=bold>$tag</>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (input()->hasOption('revision') && !empty(input()->getOption('revision'))) {
|
2017-08-12 11:56:35 +03:00
|
|
|
$revision = input()->getOption('revision');
|
2020-04-25 23:00:08 +03:00
|
|
|
$what = "revision <fg=magenta;options=bold>$revision</>";
|
2017-08-12 11:56:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (empty($what)) {
|
2020-04-25 23:00:08 +03:00
|
|
|
$what = "<fg=magenta;options=bold>HEAD</>";
|
2017-08-12 11:56:35 +03:00
|
|
|
}
|
|
|
|
|
2020-07-26 22:35:08 +03:00
|
|
|
info("deploying $what");
|
2017-08-12 11:56:35 +03:00
|
|
|
})
|
2020-04-25 23:00:08 +03:00
|
|
|
->shallow();
|