Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Publish developer-docs before other modules #257

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
GuySartorelli marked this conversation as resolved.
Show resolved Hide resolved
{
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
Loading