Skip to content

Commit

Permalink
Ping home url after deploy webhooks to force cache generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Dargham committed Mar 21, 2023
1 parent a30dc54 commit 99407bf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/DeployTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public function deploy($environment, $gitRevision, $options = ['ignore-assets' =

$this->taskDeleteDir($buildDirectory)->run();

// Run webhooks

if ($deployed) {
$site_url = $config['WEB_SCHEME'] . '://' . $config['WEB_DOMAIN'] . $config['WEB_PATH'];

Expand All @@ -72,6 +74,15 @@ public function deploy($environment, $gitRevision, $options = ['ignore-assets' =
if ($this->io()->confirm('Clear wp-cubi transient cache ?', true)) {
$this->sendWebhookHttpRequest($site_url, 'clear-wp-cubi-transient-cache');
}

// Ping home url to generate new cache

$cmd = new Command('curl');
$cmd = $cmd->arg($site_url)
->getCommand();

$this->taskExec($cmd)
->run();
}

return $deployed;
Expand Down

0 comments on commit 99407bf

Please sign in to comment.