From 5d5aadcb7339e46d89188d40c79fc1c8a9490d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mez=C3=AAncio?= Date: Tue, 3 Apr 2018 17:50:59 -0300 Subject: [PATCH 1/8] Add psr-4 autoload --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0a60dfe..7db87b2 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,10 @@ "autoload": { "files": [ "autoload.php" - ] + ], + "psr-4": { + "Deployer\\": "src/" + } }, "replace": { "deployer/recipes": "self.version" From ec1066963d3d93ea7b191ff674c3f6543d9530e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mez=C3=AAncio?= Date: Tue, 3 Apr 2018 17:51:30 -0300 Subject: [PATCH 2/8] Add default messaging --- src/Discord/Messaging.php | 59 ++++++++++++++++++++++++++++++ src/Discord/MessagingInterface.php | 26 +++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 src/Discord/Messaging.php create mode 100644 src/Discord/MessagingInterface.php diff --git a/src/Discord/Messaging.php b/src/Discord/Messaging.php new file mode 100644 index 0000000..8d67d58 --- /dev/null +++ b/src/Discord/Messaging.php @@ -0,0 +1,59 @@ + [ + [ + 'color' => 'good', + 'title' => 'My Application', + 'fields' => [ + [ + 'title' => 'Environent', + 'value' => get('stage'), + 'short' => true, + ], + ], + ], + ], + ]; + + //return [ + // 'text' => get('discord_notify_text'), + //]; + } + + /** + * @inheritdoc + */ + public function success() + { + return [ + 'text' => get('discord_success_text'), + ]; + } + + /** + * @inheritdoc + */ + public function failure() + { + return [ + 'text' => get('discord_failure_text'), + ]; + } +} diff --git a/src/Discord/MessagingInterface.php b/src/Discord/MessagingInterface.php new file mode 100644 index 0000000..f36e360 --- /dev/null +++ b/src/Discord/MessagingInterface.php @@ -0,0 +1,26 @@ + Date: Tue, 3 Apr 2018 17:51:43 -0300 Subject: [PATCH 3/8] Add Discord recipe --- recipe/discord.php | 119 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 recipe/discord.php diff --git a/recipe/discord.php b/recipe/discord.php new file mode 100644 index 0000000..ebb20f9 --- /dev/null +++ b/recipe/discord.php @@ -0,0 +1,119 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Deployer; + +use Deployer\Discord\Messaging; +use Deployer\Discord\MessagingInterface; +use Deployer\Task\Context; +use Deployer\Utility\Httpie; + +set('discord_webhook', function () { + return 'https://discordapp.com/api/webhooks/{{discord_channel}}/{{discord_token}}/slack'; +}); + +// Deploy messages +set('discord_notify_text', ':information_source: **{{user}}** is deploying branch `{{branch}}` to _{{target}}_'); +set('discord_success_text', ':white_check_mark: Branch `{{branch}}` deployed to _{{target}}_ successfully'); +set('discord_failure_text', ':no_entry_sign: Branch `{{branch}}` has failed to deploy to _{{target}}_'); + +// Tasks +desc('Setup Discord Deployer recipe'); +task('discord:setup', function () { + if (!get('discord_channel', false) || !get('discord_token', false)) { + throw new \Exception('`discord_channel` and `discord_token` must be set.'); + } + + $messagingClass = get('discord_class', false); + $objectMessaging = new Messaging(); + + if ($messagingClass !== false) { + if (!class_exists($messagingClass)) { + throw new \Exception('`discord_class` must be a valid class'); + } + + $objectMessaging = new $messagingClass(); + + if (!($objectMessaging instanceof MessagingInterface)) { + throw new \Exception('`discord_class` must implement Deployer\\Discord\\MessagingInterface'); + } + } + + set('discord_message_object', $objectMessaging); +}) + ->once() + ->shallow() + ->isPrivate() +; + +desc('Just notify your Discord channel with all messages, without deploying'); +task('discord:test', function () { + $context = Context::get(); + + $setup = task('discord:setup'); + $setup->run($context); + + /** @var MessagingInterface $discordMessageObject */ + $discordMessageObject = get('discord_message_object'); + + $notify = $discordMessageObject->notify(); + $success = $discordMessageObject->success(); + $failure = $discordMessageObject->failure(); + + Httpie::post(get('discord_webhook')) + ->body($notify) + ->send() + ; + + Httpie::post(get('discord_webhook')) + ->body($success) + ->send() + ; + + Httpie::post(get('discord_webhook')) + ->body($failure) + ->send() + ; +}) + ->once() + ->shallow() +; + +desc('Notify Discord'); +task('discord:notify', function () { + $body = get('discord_message_object')->notify(); + + Httpie::post(get('discord_webhook'))->body($body)->send(); +}) + ->once() + ->shallow() + ->isPrivate() +; + +desc('Notify Discord about deploy finish'); +task('discord:notify:success', function () { + $body = get('discord_message_object')->success(); + + Httpie::post(get('discord_webhook'))->body($body)->send(); +}) + ->once() + ->shallow() + ->isPrivate() +; + +desc('Notify Discord about deploy failure'); +task('discord:notify:failure', function () { + $body = get('discord_message_object')->failure(); + + Httpie::post(get('discord_webhook'))->body($body)->send(); +}) + ->once() + ->shallow() + ->isPrivate() +; + +after('deploy:prepare', 'discord:setup'); From 2f1b2651423accf1179194546af2e7018d959a77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mez=C3=AAncio?= Date: Tue, 3 Apr 2018 17:51:57 -0300 Subject: [PATCH 4/8] Update docs --- docs/discord.md | 102 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 docs/discord.md diff --git a/docs/discord.md b/docs/discord.md new file mode 100644 index 0000000..ed444c9 --- /dev/null +++ b/docs/discord.md @@ -0,0 +1,102 @@ +# Discord recipe + +## Installing + +Require discord recipe in your `deploy.php` file: + +```php +require 'recipe/discord.php'; +``` + +Add hook on deploy: + +```php +before('deploy', 'discord:notify'); +``` + +## Configuration + +- `discord_channel` – Discord channel ID, **required** +- `discord_token` – Discord channel token, **required** + +- `discord_notify_text` – notification message template, markdown supported, default: + ``` + :information_source: **{{user}}** is deploying branch `{{branch}}` to _{{target}}_ + ``` +- `discord_success_text` – success template, default: + ``` + :white_check_mark: Branch `{{branch}}` deployed to _{{target}}_ successfully + ``` +- `discord_failure_text` – failure template, default: + ``` + :no_entry_sign: Branch `{{branch}}` has failed to deploy to _{{target}}_ + +## Tasks + +- `discord:notify` – Notify Discord +- `discord:notify:success` – Notify Discord about deploy finish +- `discord:notify:failure` – Notify Discord about deploy failure +- `discord:test` – Just notify your Discord channel with all messages, without deploying + +## Usage + +If you want to notify only about beginning of deployment add this line only: + +```php +before('deploy', 'discord:notify'); +``` + +If you want to notify about successful end of deployment add this too: + +```php +after('success', 'discord:notify:success'); +``` + +If you want to notify about failed deployment add this too: + +```php +after('deploy:failed', 'discord:notify:failure'); +``` + +### Customization + +If you want to customize even more your messages to be sent to Discord, you can do it easily by creating a class and implementing `Deployer\Discord\MessagingInterface`, or extending `Deployer\Discord\Messaging` and then, set the `discord_class` configuration variable, just like below: + +```php + [ + [ + 'title' => 'My Application', + 'fields' => [ + [ + 'title' => 'Environent', + 'value' => get('stage'), + 'short' => true, + ], + ], + ], + ], + ]; + } +} +``` From 1a186e1f1bbe2ed8e35717bd401b4d42b1a4e437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mez=C3=AAncio?= Date: Thu, 12 Apr 2018 12:48:51 -0300 Subject: [PATCH 5/8] Remove psr-4 autoloading --- composer.json | 5 +-- src/Discord/Messaging.php | 59 ------------------------------ src/Discord/MessagingInterface.php | 26 ------------- 3 files changed, 1 insertion(+), 89 deletions(-) delete mode 100644 src/Discord/Messaging.php delete mode 100644 src/Discord/MessagingInterface.php diff --git a/composer.json b/composer.json index 7db87b2..0a60dfe 100644 --- a/composer.json +++ b/composer.json @@ -32,10 +32,7 @@ "autoload": { "files": [ "autoload.php" - ], - "psr-4": { - "Deployer\\": "src/" - } + ] }, "replace": { "deployer/recipes": "self.version" diff --git a/src/Discord/Messaging.php b/src/Discord/Messaging.php deleted file mode 100644 index 8d67d58..0000000 --- a/src/Discord/Messaging.php +++ /dev/null @@ -1,59 +0,0 @@ - [ - [ - 'color' => 'good', - 'title' => 'My Application', - 'fields' => [ - [ - 'title' => 'Environent', - 'value' => get('stage'), - 'short' => true, - ], - ], - ], - ], - ]; - - //return [ - // 'text' => get('discord_notify_text'), - //]; - } - - /** - * @inheritdoc - */ - public function success() - { - return [ - 'text' => get('discord_success_text'), - ]; - } - - /** - * @inheritdoc - */ - public function failure() - { - return [ - 'text' => get('discord_failure_text'), - ]; - } -} diff --git a/src/Discord/MessagingInterface.php b/src/Discord/MessagingInterface.php deleted file mode 100644 index f36e360..0000000 --- a/src/Discord/MessagingInterface.php +++ /dev/null @@ -1,26 +0,0 @@ - Date: Thu, 12 Apr 2018 12:49:26 -0300 Subject: [PATCH 6/8] Attach Discord Messaging class into Discord recipe --- recipe/discord.php | 264 +++++++++++++++++++++++++++------------------ 1 file changed, 159 insertions(+), 105 deletions(-) diff --git a/recipe/discord.php b/recipe/discord.php index ebb20f9..b61bfd9 100644 --- a/recipe/discord.php +++ b/recipe/discord.php @@ -5,115 +5,169 @@ * file that was distributed with this source code. */ -namespace Deployer; - -use Deployer\Discord\Messaging; -use Deployer\Discord\MessagingInterface; -use Deployer\Task\Context; -use Deployer\Utility\Httpie; - -set('discord_webhook', function () { - return 'https://discordapp.com/api/webhooks/{{discord_channel}}/{{discord_token}}/slack'; -}); - -// Deploy messages -set('discord_notify_text', ':information_source: **{{user}}** is deploying branch `{{branch}}` to _{{target}}_'); -set('discord_success_text', ':white_check_mark: Branch `{{branch}}` deployed to _{{target}}_ successfully'); -set('discord_failure_text', ':no_entry_sign: Branch `{{branch}}` has failed to deploy to _{{target}}_'); - -// Tasks -desc('Setup Discord Deployer recipe'); -task('discord:setup', function () { - if (!get('discord_channel', false) || !get('discord_token', false)) { - throw new \Exception('`discord_channel` and `discord_token` must be set.'); - } +namespace Deployer { + use Deployer\Discord\Messaging; + use Deployer\Discord\MessagingInterface; + use Deployer\Task\Context; + use Deployer\Utility\Httpie; + + set('discord_webhook', function () { + return 'https://discordapp.com/api/webhooks/{{discord_channel}}/{{discord_token}}/slack'; + }); + + // Deploy messages + set('discord_notify_text', ':information_source: **{{user}}** is deploying branch `{{branch}}` to _{{target}}_'); + set('discord_success_text', ':white_check_mark: Branch `{{branch}}` deployed to _{{target}}_ successfully'); + set('discord_failure_text', ':no_entry_sign: Branch `{{branch}}` has failed to deploy to _{{target}}_'); + + // Tasks + desc('Setup Discord Deployer recipe'); + task('discord:setup', function () { + if (!get('discord_channel', false) || !get('discord_token', false)) { + throw new \Exception('`discord_channel` and `discord_token` must be set.'); + } - $messagingClass = get('discord_class', false); - $objectMessaging = new Messaging(); + $messagingClass = get('discord_class', false); + $objectMessaging = new Messaging(); - if ($messagingClass !== false) { - if (!class_exists($messagingClass)) { - throw new \Exception('`discord_class` must be a valid class'); - } + if ($messagingClass !== false) { + if (!class_exists($messagingClass)) { + throw new \Exception('`discord_class` must be a valid class'); + } - $objectMessaging = new $messagingClass(); + $objectMessaging = new $messagingClass(); - if (!($objectMessaging instanceof MessagingInterface)) { - throw new \Exception('`discord_class` must implement Deployer\\Discord\\MessagingInterface'); + if (!($objectMessaging instanceof MessagingInterface)) { + throw new \Exception('`discord_class` must implement Deployer\\Discord\\MessagingInterface'); + } } + + set('discord_message_object', $objectMessaging); + }) + ->once() + ->shallow() + ->isPrivate(); + + desc('Just notify your Discord channel with all messages, without deploying'); + task('discord:test', function () { + $context = Context::get(); + + $setup = task('discord:setup'); + $setup->run($context); + + /** @var MessagingInterface $discordMessageObject */ + $discordMessageObject = get('discord_message_object'); + + $notify = $discordMessageObject->notify(); + $success = $discordMessageObject->success(); + $failure = $discordMessageObject->failure(); + + Httpie::post(get('discord_webhook')) + ->body($notify) + ->send(); + + Httpie::post(get('discord_webhook')) + ->body($success) + ->send(); + + Httpie::post(get('discord_webhook')) + ->body($failure) + ->send(); + }) + ->once() + ->shallow(); + + desc('Notify Discord'); + task('discord:notify', function () { + $body = get('discord_message_object')->notify(); + + Httpie::post(get('discord_webhook'))->body($body)->send(); + }) + ->once() + ->shallow() + ->isPrivate(); + + desc('Notify Discord about deploy finish'); + task('discord:notify:success', function () { + $body = get('discord_message_object')->success(); + + Httpie::post(get('discord_webhook'))->body($body)->send(); + }) + ->once() + ->shallow() + ->isPrivate(); + + desc('Notify Discord about deploy failure'); + task('discord:notify:failure', function () { + $body = get('discord_message_object')->failure(); + + Httpie::post(get('discord_webhook'))->body($body)->send(); + }) + ->once() + ->shallow() + ->isPrivate(); + + after('deploy:prepare', 'discord:setup'); +} + +/** + * + */ +namespace Deployer\Discord { + /** + * Interface MessagingInterface + * + * @package Deployer\Discord + */ + interface MessagingInterface + { + /** + * @return array + */ + public function notify(); + /** + * @return array + */ + public function success(); + /** + * @return array + */ + public function failure(); } - set('discord_message_object', $objectMessaging); -}) - ->once() - ->shallow() - ->isPrivate() -; - -desc('Just notify your Discord channel with all messages, without deploying'); -task('discord:test', function () { - $context = Context::get(); - - $setup = task('discord:setup'); - $setup->run($context); - - /** @var MessagingInterface $discordMessageObject */ - $discordMessageObject = get('discord_message_object'); - - $notify = $discordMessageObject->notify(); - $success = $discordMessageObject->success(); - $failure = $discordMessageObject->failure(); - - Httpie::post(get('discord_webhook')) - ->body($notify) - ->send() - ; - - Httpie::post(get('discord_webhook')) - ->body($success) - ->send() - ; - - Httpie::post(get('discord_webhook')) - ->body($failure) - ->send() - ; -}) - ->once() - ->shallow() -; - -desc('Notify Discord'); -task('discord:notify', function () { - $body = get('discord_message_object')->notify(); - - Httpie::post(get('discord_webhook'))->body($body)->send(); -}) - ->once() - ->shallow() - ->isPrivate() -; - -desc('Notify Discord about deploy finish'); -task('discord:notify:success', function () { - $body = get('discord_message_object')->success(); - - Httpie::post(get('discord_webhook'))->body($body)->send(); -}) - ->once() - ->shallow() - ->isPrivate() -; - -desc('Notify Discord about deploy failure'); -task('discord:notify:failure', function () { - $body = get('discord_message_object')->failure(); - - Httpie::post(get('discord_webhook'))->body($body)->send(); -}) - ->once() - ->shallow() - ->isPrivate() -; - -after('deploy:prepare', 'discord:setup'); + /** + * Class Messaging + * + * @package Deployer\Discord + */ + class Messaging implements MessagingInterface + { + /** + * @inheritdoc + */ + public function notify() + { + return [ + 'text' => get('discord_notify_text'), + ]; + } + /** + * @inheritdoc + */ + public function success() + { + return [ + 'text' => get('discord_success_text'), + ]; + } + /** + * @inheritdoc + */ + public function failure() + { + return [ + 'text' => get('discord_failure_text'), + ]; + } + } +} From 24ebaa9b245c168824f1707b687767b81a9b904f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mez=C3=AAncio?= Date: Thu, 19 Apr 2018 15:20:35 -0300 Subject: [PATCH 7/8] Remove classes and namespaces --- recipe/discord.php | 226 ++++++++++++--------------------------------- 1 file changed, 60 insertions(+), 166 deletions(-) diff --git a/recipe/discord.php b/recipe/discord.php index b61bfd9..85793d4 100644 --- a/recipe/discord.php +++ b/recipe/discord.php @@ -5,169 +5,63 @@ * file that was distributed with this source code. */ -namespace Deployer { - use Deployer\Discord\Messaging; - use Deployer\Discord\MessagingInterface; - use Deployer\Task\Context; - use Deployer\Utility\Httpie; - - set('discord_webhook', function () { - return 'https://discordapp.com/api/webhooks/{{discord_channel}}/{{discord_token}}/slack'; - }); - - // Deploy messages - set('discord_notify_text', ':information_source: **{{user}}** is deploying branch `{{branch}}` to _{{target}}_'); - set('discord_success_text', ':white_check_mark: Branch `{{branch}}` deployed to _{{target}}_ successfully'); - set('discord_failure_text', ':no_entry_sign: Branch `{{branch}}` has failed to deploy to _{{target}}_'); - - // Tasks - desc('Setup Discord Deployer recipe'); - task('discord:setup', function () { - if (!get('discord_channel', false) || !get('discord_token', false)) { - throw new \Exception('`discord_channel` and `discord_token` must be set.'); - } - - $messagingClass = get('discord_class', false); - $objectMessaging = new Messaging(); - - if ($messagingClass !== false) { - if (!class_exists($messagingClass)) { - throw new \Exception('`discord_class` must be a valid class'); - } - - $objectMessaging = new $messagingClass(); - - if (!($objectMessaging instanceof MessagingInterface)) { - throw new \Exception('`discord_class` must implement Deployer\\Discord\\MessagingInterface'); - } - } - - set('discord_message_object', $objectMessaging); - }) - ->once() - ->shallow() - ->isPrivate(); - - desc('Just notify your Discord channel with all messages, without deploying'); - task('discord:test', function () { - $context = Context::get(); - - $setup = task('discord:setup'); - $setup->run($context); - - /** @var MessagingInterface $discordMessageObject */ - $discordMessageObject = get('discord_message_object'); - - $notify = $discordMessageObject->notify(); - $success = $discordMessageObject->success(); - $failure = $discordMessageObject->failure(); - - Httpie::post(get('discord_webhook')) - ->body($notify) - ->send(); - - Httpie::post(get('discord_webhook')) - ->body($success) - ->send(); - - Httpie::post(get('discord_webhook')) - ->body($failure) - ->send(); - }) - ->once() - ->shallow(); - - desc('Notify Discord'); - task('discord:notify', function () { - $body = get('discord_message_object')->notify(); - - Httpie::post(get('discord_webhook'))->body($body)->send(); - }) - ->once() - ->shallow() - ->isPrivate(); - - desc('Notify Discord about deploy finish'); - task('discord:notify:success', function () { - $body = get('discord_message_object')->success(); - - Httpie::post(get('discord_webhook'))->body($body)->send(); - }) - ->once() - ->shallow() - ->isPrivate(); - - desc('Notify Discord about deploy failure'); - task('discord:notify:failure', function () { - $body = get('discord_message_object')->failure(); - - Httpie::post(get('discord_webhook'))->body($body)->send(); - }) - ->once() - ->shallow() - ->isPrivate(); - - after('deploy:prepare', 'discord:setup'); -} - -/** - * - */ -namespace Deployer\Discord { - /** - * Interface MessagingInterface - * - * @package Deployer\Discord - */ - interface MessagingInterface - { - /** - * @return array - */ - public function notify(); - /** - * @return array - */ - public function success(); - /** - * @return array - */ - public function failure(); - } - - /** - * Class Messaging - * - * @package Deployer\Discord - */ - class Messaging implements MessagingInterface - { - /** - * @inheritdoc - */ - public function notify() - { - return [ - 'text' => get('discord_notify_text'), - ]; - } - /** - * @inheritdoc - */ - public function success() - { - return [ - 'text' => get('discord_success_text'), - ]; - } - /** - * @inheritdoc - */ - public function failure() - { - return [ - 'text' => get('discord_failure_text'), - ]; - } - } -} +use Deployer\Task\Context; +use Deployer\Utility\Httpie; + +set('discord_webhook', function () { + return 'https://discordapp.com/api/webhooks/{{discord_channel}}/{{discord_token}}/slack'; +}); + +// Deploy messages +set('discord_notify_text', [ + 'text' => ':information_source: **{{user}}** is deploying branch `{{branch}}` to _{{target}}_', +]); +set('discord_success_text', [ + 'text' => ':white_check_mark: Branch `{{branch}}` deployed to _{{target}}_ successfully', +]); +set('discord_failure_text', [ + 'text' => ':no_entry_sign: Branch `{{branch}}` has failed to deploy to _{{target}}_', +]); + +// Helpers +set('send_message', function ($data) { + Httpie::post(get('discord_webhook'))->body($data)->send(); +}); + +// Tasks +desc('Just notify your Discord channel with all messages, without deploying'); +task('discord:test', function () { + $notify = get('discord_notify_text'); + $success = get('discord_success_text'); + $failure = get('discord_failure_text'); + + get('send_message')($notify); + get('send_message')($success); + get('send_message')($failure); +}) + ->once() + ->shallow(); + +desc('Notify Discord'); +task('discord:notify', function () { + get('send_message')(get('discord_notify_text')); +}) + ->once() + ->shallow() + ->isPrivate(); + +desc('Notify Discord about deploy finish'); +task('discord:notify:success', function () { + get('send_message')(get('discord_success_text')); +}) + ->once() + ->shallow() + ->isPrivate(); + +desc('Notify Discord about deploy failure'); +task('discord:notify:failure', function () { + get('send_message')(get('discord_failure_text')); +}) + ->once() + ->shallow() + ->isPrivate(); From 40b74458335d5620720f1eca07fdb2dd248eabf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Mez=C3=AAncio?= Date: Thu, 19 Apr 2018 15:32:07 -0300 Subject: [PATCH 8/8] Update readme --- docs/discord.md | 61 ++++++++++--------------------------------------- 1 file changed, 12 insertions(+), 49 deletions(-) diff --git a/docs/discord.md b/docs/discord.md index ed444c9..33274dc 100644 --- a/docs/discord.md +++ b/docs/discord.md @@ -20,16 +20,22 @@ before('deploy', 'discord:notify'); - `discord_token` – Discord channel token, **required** - `discord_notify_text` – notification message template, markdown supported, default: - ``` - :information_source: **{{user}}** is deploying branch `{{branch}}` to _{{target}}_ + ```php + [ + 'text' => ':information_source: **{{user}}** is deploying branch `{{branch}}` to _{{target}}_', + ] ``` - `discord_success_text` – success template, default: - ``` - :white_check_mark: Branch `{{branch}}` deployed to _{{target}}_ successfully + ```php + [ + 'text' => ':white_check_mark: Branch `{{branch}}` deployed to _{{target}}_ successfully', + ] ``` - `discord_failure_text` – failure template, default: - ``` - :no_entry_sign: Branch `{{branch}}` has failed to deploy to _{{target}}_ + ```php + [ + 'text' => ':no_entry_sign: Branch `{{branch}}` has failed to deploy to _{{target}}_', + ] ## Tasks @@ -57,46 +63,3 @@ If you want to notify about failed deployment add this too: ```php after('deploy:failed', 'discord:notify:failure'); ``` - -### Customization - -If you want to customize even more your messages to be sent to Discord, you can do it easily by creating a class and implementing `Deployer\Discord\MessagingInterface`, or extending `Deployer\Discord\Messaging` and then, set the `discord_class` configuration variable, just like below: - -```php - [ - [ - 'title' => 'My Application', - 'fields' => [ - [ - 'title' => 'Environent', - 'value' => get('stage'), - 'short' => true, - ], - ], - ], - ], - ]; - } -} -```