Skip to content

Commit

Permalink
Allow disable the default release worker (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
kayw-geek authored Aug 18, 2023
1 parent 4100cd5 commit f05ab0a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@ return static function (MBConfig $mbConfig): void {
};
```

These `TagVersionReleaseWorker` and `PushTagReleaseWorker` are enabled by default.
If you want to disable these default workers, you can use the following code.

```php
return static function (MBConfig $mbConfig): void {
$mbConfig->disableDefaultWorkers();
};
```

You can also include your own workers. Just add services that implements `ReleaseWorkerInterface`.
Are you afraid to tag and push? Use `--dry-run` to see only descriptions:

Expand Down
8 changes: 5 additions & 3 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@
__DIR__ . '/../packages/Release/ReleaseWorker',
]);

// add default for easy tag and push without need to make configs
$services->set(TagVersionReleaseWorker::class);
$services->set(PushTagReleaseWorker::class);
if (! $mbConfig->isDisableDefaultWorkers()) {
// add default for easy tag and push without need to make configs
$services->set(TagVersionReleaseWorker::class);
$services->set(PushTagReleaseWorker::class);
}

$services->load('Symplify\MonorepoBuilder\\', __DIR__ . '/../src')
->exclude([
Expand Down
12 changes: 12 additions & 0 deletions src/Config/MBConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

final class MBConfig extends ContainerConfigurator
{
private static bool $disableDefaultWorkers = false;

/**
* @param string[] $packageDirectories
*/
Expand All @@ -23,6 +25,16 @@ public function packageDirectories(array $packageDirectories): void
$parameters->set(Option::PACKAGE_DIRECTORIES, $packageDirectories);
}

public static function isDisableDefaultWorkers(): bool
{
return self::$disableDefaultWorkers;
}

public static function disableDefaultWorkers(): void
{
self::$disableDefaultWorkers = true;
}

/**
* @param string[] $packageDirectories
*/
Expand Down

0 comments on commit f05ab0a

Please sign in to comment.