Skip to content

Commit

Permalink
ENH Publish developer-docs before other modules
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed May 20, 2024
1 parent ebf2046 commit 431af38
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions src/Steps/Release/PublishRelease.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,33 @@ public function run(InputInterface $input, OutputInterface $output)
{
$this->log($output, "Running release of all modules");

// Release silverstripe/developer-docs before all other modules so that the github workflow
// to deploy the updated changelog to netlify is run before CI gets bogged down by everything else.
$developerDocs = $this->findLibraryRecursive($this->getReleasePlan(), 'silverstripe/developer-docs');
$this->releaseLibrary($output, $developerDocs, true);

$this->releaseRecursive($output, $this->getReleasePlan());

$this->log($output, "All releases published");
}

/**
* Find a library in the release plan
*/
protected function findLibraryRecursive(LibraryRelease $releasePlanNode, string $name): ?LibraryRelease
{
if ($releasePlanNode->getLibrary()->getName() === $name) {
return $releasePlanNode;
}
foreach ($releasePlanNode->getItems() as $item) {
$ret = $this->findLibraryRecursive($item, $name);
if ($ret) {
return $ret;
}
}
return null;
}

/**
* Release a library
*
Expand Down Expand Up @@ -69,14 +91,22 @@ protected function releaseRecursive(OutputInterface $output, LibraryRelease $rel
*
* @param OutputInterface $output
* @param LibraryRelease $releasePlanNode Node in release plan being released
* @param bool $releaseDeveloperDocs - Whether to release silverstripe/developer-docs
*/
protected function releaseLibrary(OutputInterface $output, LibraryRelease $releasePlanNode)
{
protected function releaseLibrary(
OutputInterface $output,
LibraryRelease $releasePlanNode,
bool $releaseDeveloperDocs = false
) {
// Release this library
$library = $releasePlanNode->getLibrary();
$branch = $library->getBranch();
$name = $library->getName();

if ($name === 'silverstripe/developer-docs' && !$releaseDeveloperDocs) {
return;
}

// Confirm we're on a minor branch and exit if not
if (!$releasePlanNode->isOnCorrectMinorReleaseBranch()) {
$this->log(
Expand Down

0 comments on commit 431af38

Please sign in to comment.