Install recipes through composer:
composer require deployer/recipes --dev
Require slack recipe in your deploy.php
file:
note: currently there is a bug in the autoloader detection requiring users to specify the full path (more info).
//require 'recipe/slack.php';
require 'vendor/deployer/recipes/recipe/slack.php';
Add hook on deploy:
before('deploy', 'slack:notify');
-
slack_webhook
– slack incoming webhook url, requiredset('slack_webhook', 'https://hooks.slack.com/...');
-
slack_title
– the title of application, default{{application}}
-
slack_text
– notification message template, markdown supportedset('slack_text', '_{{user}}_ deploying `{{branch}}` to *{{target}}*');
-
slack_success_text
– success template, default:set('slack_success_text', 'Deploy to *{{target}}* successful');
-
slack_failure_text
– failure template, default:set('slack_failure_text', 'Deploy to *{{target}}* failed');
-
slack_color
– color's attachment -
slack_success_color
– success color's attachment -
slack_failure_color
– failure color's attachment
slack:notify
– send message to slackslack:notify:success
– send success message to slackslack:notify:failure
– send failure message to slack
If you want to notify only about beginning of deployment add this line only:
before('deploy', 'slack:notify');
If you want to notify about successful end of deployment add this too:
after('success', 'slack:notify:success');
If you want to notify about failed deployment add this too:
after('deploy:failed', 'slack:notify:failure');