diff --git a/src/Model/Modules/Library.php b/src/Model/Modules/Library.php index 47c4ff7..c601d8e 100644 --- a/src/Model/Modules/Library.php +++ b/src/Model/Modules/Library.php @@ -683,6 +683,19 @@ public function getName() return $data['name']; } + /** + * Get type of this library + */ + public function getType(): string + { + $data = $this->getComposerData(); + return $data['type'] ?? ''; + } + + public function isRecipe(): bool + { + return $this->getType() === 'silverstripe-recipe'; + } /** * Get link to github module diff --git a/src/Steps/Release/MergeUpRelease.php b/src/Steps/Release/MergeUpRelease.php index 9b9338b..d0ae3af 100644 --- a/src/Steps/Release/MergeUpRelease.php +++ b/src/Steps/Release/MergeUpRelease.php @@ -144,7 +144,9 @@ protected function mergeUp( } // Step 3. Convert constraints to the appropriate dev format - ConstraintStabiliser::destabiliseConstraints($output, $releasePlanNode, $isMajorBranch); + if ($library->isRecipe()) { + ConstraintStabiliser::destabiliseConstraints($output, $releasePlanNode, $isMajorBranch); + } // Step 4. Push branch if ($pushToRemote) { diff --git a/src/Steps/Release/PublishRelease.php b/src/Steps/Release/PublishRelease.php index c1d60e1..bc018a7 100644 --- a/src/Steps/Release/PublishRelease.php +++ b/src/Steps/Release/PublishRelease.php @@ -92,13 +92,17 @@ protected function releaseLibrary(OutputInterface $output, LibraryRelease $relea $this->log($output, "Releasing library {$name} at version {$versionName}"); // Step 1: Rewrite composer.json to all tagged versions only - ConstraintStabiliser::stabiliseConstraints($output, $releasePlanNode); + if ($library->isRecipe()) { + ConstraintStabiliser::stabiliseConstraints($output, $releasePlanNode); + } // Step 2: Tag and push this tag $this->publishTag($output, $releasePlanNode); // Step 3: Rewrite composer.json to destabilise requirements - ConstraintStabiliser::destabiliseConstraints($output, $releasePlanNode, false); + if ($library->isRecipe()) { + ConstraintStabiliser::destabiliseConstraints($output, $releasePlanNode, false); + } // Step 4: Push development branch to origin $this->log($output, "Pushing branch {$branch}"); diff --git a/src/Steps/Release/RewriteReleaseBranches.php b/src/Steps/Release/RewriteReleaseBranches.php index b6394fc..50b46e4 100644 --- a/src/Steps/Release/RewriteReleaseBranches.php +++ b/src/Steps/Release/RewriteReleaseBranches.php @@ -67,10 +67,11 @@ protected function recursiveBranchLibrary(OutputInterface $output, LibraryReleas $this->checkoutLibrary($output, $libraryRelease->getLibrary(), $libraryRelease->getVersion()); } - // Ensure any newly created branches have the correct 4.12.x-dev contraints - // need to do this because new branches would have been branched from - // recipes with 4.x-dev contraints - ConstraintStabiliser::destabiliseConstraints($output, $libraryRelease, false); + // Ensure any newly created branches on recipes have the correct 4.12.x-dev contraint format. + // Need to do this because new branches would have been branched from recipes with 4.x-dev contraint format. + if ($libraryRelease->getLibrary()->isRecipe()) { + ConstraintStabiliser::destabiliseConstraints($output, $libraryRelease, false); + } } /**