Skip to content

Commit

Permalink
feat: add deploy_seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
innocenzi committed Sep 12, 2023
1 parent e2edb7f commit 478e515
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ private function configureDeployer(): void
set('commit_short_sha', fn () => runLocally('git log -n 1 --pretty=format:"%h"'));
set('commit_text', fn () => runLocally('git log -n 1 --pretty=format:"%s"'));

// Timing
before('deploy:setup', fn () => set('deploy_started_at', time()));
before('deploy:success', fn () => set('deploy_seconds', (int) (time() - get('deploy_started_at'))));

$this->configureSiteDirectoryDeletion();
$this->improveDeployInfoTask();
$this->configureDeploymentTriggerOnForge();
Expand Down Expand Up @@ -150,13 +154,13 @@ private function configureSlackNotifications(): void
}

set('slack_webhook', $this->environment->slackWebhookUrl);
set('slack_title', '{{site_url}}');
set('slack_title', '<{{site_url}}|{{site_name}}>');
set('slack_text', implode("\n", [
'*{{commit_author}}* is deploying <{{repository_url}}|{{repository_name}}> ({{repository_branch}})',
'*Links*: <{{runner_url}}|GitHub workflow>, <{{forge_site_url}}|Forge site>',
'*Commit*: _{{commit_text}}_ (<{{commit_url}}|`{{commit_short_sha}}`>)',
]));
set('slack_success_text', 'Deployment successful.');
set('slack_success_text', 'Deployment successful in {{deploy_seconds}} seconds.');
set('slack_failure_text', 'Deployment failed.');
set('slack_rollback_text', '*{{user}}* rolled back last deployment ({{rollback_name}}).');
set('slack_color', '#38bdf8');
Expand Down

0 comments on commit 478e515

Please sign in to comment.