Back to Deployer

Discord Recipe

docs/contrib/discord.md

8.0.33.3 KB
Original Source
<!-- DO NOT EDIT THIS FILE! --> <!-- Instead edit contrib/discord.php --> <!-- Then run bin/docgen -->

Discord Recipe

php
require 'contrib/discord.php';

Source

Installing

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:
    markdown
    :&#8203;information_source: **{{user}}** is deploying branch `{{branch}}` to _{{where}}_
    
  • discord_success_text – success template, default:
    markdown
    :&#8203;white_check_mark: Branch `{{branch}}` deployed to _{{where}}_ successfully
    
  • discord_failure_text – failure template, default:
    markdown
    :&#8203;no_entry_sign: Branch `{{branch}}` has failed to deploy to _{{where}}_
    

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('deploy:success', 'discord:notify:success');

If you want to notify about failed deployment add this too:

php
after('deploy:failed', 'discord:notify:failure');

Configuration

discord_webhook

Source

php
return 'https://discordapp.com/api/webhooks/{{discord_channel}}/{{discord_token}}/slack';

discord_notify_text

Source

Deploy messages

php
return [
'text' => parse(':&#8203;information_source: **{{user}}** is deploying branch `{{what}}` to _{{where}}_'),
];

discord_success_text

Source

php
return [
'text' => parse(':&#8203;white_check_mark: Branch `{{what}}` deployed to _{{where}}_ successfully'),
];

discord_failure_text

Source

php
return [
'text' => parse(':&#8203;no_entry_sign: Branch `{{what}}` has failed to deploy to _{{where}}_'),
];

discord_message

Source

The message

php
'discord_notify_text'

Tasks

discord_send_message {#discord_send_message}

Source

Helpers

discord:test {#discord-test}

Source

Tests messages.

Tasks

discord:notify {#discord-notify}

Source

Notifies Discord.

discord:notify:success {#discord-notify-success}

Source

Notifies Discord about deploy finish.

discord:notify:failure {#discord-notify-failure}

Source

Notifies Discord about deploy failure.