48 lines
1.2 KiB
PHP
Raw Normal View History

<?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;
});
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</>";
}
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'))) {
$revision = input()->getOption('revision');
2020-04-25 23:00:08 +03:00
$what = "revision <fg=magenta;options=bold>$revision</>";
}
if (empty($what)) {
2020-04-25 23:00:08 +03:00
$what = "<fg=magenta;options=bold>HEAD</>";
}
2020-07-26 22:35:08 +03:00
info("deploying $what");
})
2020-04-25 23:00:08 +03:00
->shallow();