Example #1
0
Release::header(sprintf('Release application "%s" tag "%s"', Project::name(), $tag));
$commit = Release::prompt('Choose commit to release', 'HEAD');
if (Project::havePreEnv()) {
    $commands = array('git branch -f pre ' . $commit, 'git push -f origin pre:pre');
    Release::display($commands);
    if ($prev = Release::confirm()) {
        Release::exec($commands);
    }
} else {
    $prev = true;
    // not have pre (same as confirm)
}
// ---------------------------------------------------------------------------------------------------------------------
// Build pre
// ---------------------------------------------------------------------------------------------------------------------
if (Project::haveName() && Project::havePreEnv()) {
    $commands = array('ssh ' . Project::name() . '@' . Project::name() . '.pre.brzy.cz');
    Release::display($commands);
    if ($prev && ($prev = Release::confirm())) {
        Release::exec($commands);
    }
    echo PHP_EOL . 'Check tests results:' . PHP_EOL . '  http://' . Project::name() . '.pre.brzy.cz:8088/logviewer/index.php?lines=200&tail=1&action=show&log=%2Fvar%2Fwww%2F' . Project::name() . '%2Flogs%2Fdeploy%2Ftests.log' . PHP_EOL;
} else {
    $prev = true;
}
// ---------------------------------------------------------------------------------------------------------------------
// Push new tag to server
// ---------------------------------------------------------------------------------------------------------------------
$commands = array('git tag ' . $tag . ' ' . $commit, 'git push origin ' . $tag);
Release::display($commands);
if ($prev && ($prev = Release::confirm())) {