public function RoboFile::releasePush in Panopoly 7
Release Stage 2: Pushes commits and tags to the Git remote.
Parameters
string $new_version: The new version that we are pushing.
Return value
\Robo\Collection\CollectionBuilder
Throws
\Exception
1 call to RoboFile::releasePush()
- RoboFile::release in ./
RoboFile.php - Runs all 3 stages of the release process in order.
File
- ./
RoboFile.php, line 789
Class
- RoboFile
- This is project's console commands configuration for Robo task runner.
Code
public function releasePush($new_version) {
$branch = static::PANOPOLY_DEFAULT_BRANCH;
if ($this
->getCurrentBranch() !== $branch) {
throw new \Exception("Only run this command on the {$branch} branch");
}
// If git tag doesn't exist, then bail completely.
if ($this
->runProcess("git rev-parse {$new_version}")
->getExitCode() !== 0) {
throw new \Exception("Tag {$new_version} doesn't exist");
}
/** @var \Robo\Collection\CollectionBuilder|$this $collection */
$collection = $this
->collectionBuilder();
// Push the changes out to both the monorepo and manyrepos.
$collection
->taskExecStack()
->exec("git push")
->exec("git push --tags");
$collection
->addTask($this
->subtreeSplit([
'push' => TRUE,
]));
// Pull the commits down into our local checkouts of the manyrepos, so
// we can tag and push those as well.
$collection
->addTask($this
->checkoutManyreposForRelease($branch));
foreach ($this
->getPanopolyFeatures() as $panopoly_feature) {
$panopoly_feature_release_path = "release/{$panopoly_feature}";
if ($panopoly_feature === 'panopoly_demo') {
$collection
->taskExecStack()
->exec("git -C {$panopoly_feature_release_path} push")
->exec("git -C {$panopoly_feature_release_path} push --tags");
}
else {
$collection
->taskExecStack()
->exec("git -C {$panopoly_feature_release_path} tag {$new_version}")
->exec("git -C {$panopoly_feature_release_path} push --tags");
}
}
return $collection;
}