You are here

public function RoboFile::release in Panopoly 7

Runs all 3 stages of the release process in order.

@option bool $clean If passed, the repos under `release/` will be cleaned up before starting. @option bool $push-and-publish If passed, will not only create the release, but will also push and publish it. @option string $username The Drupal.org username. @option string $password The Drupal.org password. @option string $totp-secret The TOTP secret, if your Drupal.org account uses TFA. @option bool $skip-checkout-repos Skip checking out the release repos if they are already up-to-date. @option bool $no-stop Don't stop Mink after the release is done or errors out. @option string $wd-host The Webdriver (aka Selenium) end-point to connect to.

Parameters

string $old_version: The previous version.

string $new_version: The new version.

Return value

\Robo\Collection\CollectionBuilder

Throws

\Exception

File

./RoboFile.php, line 1042

Class

RoboFile
This is project's console commands configuration for Robo task runner.

Code

public function release($old_version, $new_version, $opts = [
  'clean' => FALSE,
  'push-and-publish' => FALSE,
  'username' => NULL,
  'password' => NULL,
  'totp-secret' => NULL,
  'no-stop' => FALSE,
  'wd-host' => 'http://chromedriver:4444/wd/hub',
]) {

  /** @var \Robo\Collection\CollectionBuilder|$this $collection */
  $collection = $this
    ->collectionBuilder();

  // If git tag already exists, then bail completely.
  if ($this
    ->runProcess("git rev-parse {$new_version}")
    ->getExitCode() !== 0) {
    $collection
      ->addTask($this
      ->releaseCreate($old_version, $new_version, [
      'clean' => $opts['clean'],
    ]));
  }
  if ($opts['push-and-publish']) {
    $collection
      ->addTask($this
      ->releasePush($new_version));
    $collection
      ->addTask($this
      ->releasePublish($old_version, $new_version, [
      'username' => $opts['username'],
      'password' => $opts['password'],
      'totp-secret' => $opts['totp-secret'],
      'wd-host' => $opts['wd-host'],
      'no-stop' => $opts['no-stop'],
      // We don't need to check because we just did in releasePush().
      'skip-checkout-repos' => TRUE,
    ]));
  }
  return $collection;
}