Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion src/Deployer/Task/After/AfterTaskGlobal.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

use Hypernode\Deploy\Deployer\Task\TaskBase;
use Hypernode\Deploy\Deployer\TaskBuilder;
use Hypernode\DeployConfiguration\Command\Command;
use Hypernode\DeployConfiguration\Configuration;
use Hypernode\DeployConfiguration\TaskConfigurationInterface;

use function count;
use function Deployer\task;
Expand All @@ -24,7 +26,12 @@ public function __construct(TaskBuilder $taskBuilder)

public function configure(Configuration $config): void
{
$tasks = $this->taskBuilder->buildAll($config->getAfterDeployTasks(), 'deploy:after');
$commands = array_values(array_filter(
$config->getAfterDeployTasks(),
fn (TaskConfigurationInterface $task): bool => $task instanceof Command
));

$tasks = $this->taskBuilder->buildAll($commands, 'deploy:after');
if (count($tasks) === 0) {
$tasks = function (): void {
writeln('No after deploy tasks defined');
Expand Down
3 changes: 1 addition & 2 deletions src/Deployer/TaskBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class TaskBuilder
{
/**
* @param TaskConfigurationInterface[] $commands
* @param Command[] $commands
*
* @param string $namePrefix
* @return string[]
Expand All @@ -32,7 +32,6 @@ public function buildAll(array $commands, string $namePrefix): array
foreach ($commands as $command) {
$name = $namePrefix . ':' . \count($tasks);

/** @var Command $command */
$this->build($command, $name);

$tasks[] = $name;
Expand Down
Loading