2021-09-26 15:25:58 +02:00
|
|
|
|
<!-- DO NOT EDIT THIS FILE! -->
|
|
|
|
|
<!-- Instead edit contrib/discord.php -->
|
|
|
|
|
<!-- Then run bin/docgen -->
|
|
|
|
|
|
|
|
|
|
# discord
|
|
|
|
|
|
|
|
|
|
[Source](/contrib/discord.php)
|
|
|
|
|
|
|
|
|
|
|
2021-11-06 19:02:51 +01:00
|
|
|
|
|
2021-09-26 15:25:58 +02:00
|
|
|
|
## Installing
|
|
|
|
|
|
|
|
|
|
Require discord recipe in your `deploy.php` file:
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
require 'contrib/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:
|
|
|
|
|
```markdown
|
|
|
|
|
:​information_source: **{{user}}** is deploying branch `{{branch}}` to _{{target}}_
|
|
|
|
|
```
|
|
|
|
|
- `discord_success_text` – success template, default:
|
|
|
|
|
```markdown
|
|
|
|
|
:​white_check_mark: Branch `{{branch}}` deployed to _{{target}}_ successfully
|
|
|
|
|
```
|
|
|
|
|
- `discord_failure_text` – failure template, default:
|
|
|
|
|
```markdown
|
|
|
|
|
:​no_entry_sign: Branch `{{branch}}` has failed to deploy to _{{target}}_
|
|
|
|
|
|
|
|
|
|
## 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](https://github.com/deployphp/deployer/blob/master/contrib/discord.php#L59)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### discord_notify_text
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/discord.php#L64)
|
|
|
|
|
|
|
|
|
|
Deploy messages
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### discord_success_text
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/discord.php#L69)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### discord_failure_text
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/discord.php#L74)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### discord_message
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/discord.php#L81)
|
|
|
|
|
|
|
|
|
|
The message
|
|
|
|
|
|
|
|
|
|
```php title="Default value"
|
|
|
|
|
'discord_notify_text'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Tasks
|
|
|
|
|
|
|
|
|
|
### discord_send_message
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/discord.php#L84)
|
|
|
|
|
|
2021-09-26 15:43:51 +02:00
|
|
|
|
|
2021-09-26 15:25:58 +02:00
|
|
|
|
|
|
|
|
|
Helpers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### discord:test
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/discord.php#L92)
|
|
|
|
|
|
|
|
|
|
Just notify your Discord channel with all messages, without deploying.
|
|
|
|
|
|
|
|
|
|
Tasks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### discord:notify
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/discord.php#L104)
|
|
|
|
|
|
|
|
|
|
Notify Discord.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### discord:notify:success
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/discord.php#L113)
|
|
|
|
|
|
|
|
|
|
Notify Discord about deploy finish.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### discord:notify:failure
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/discord.php#L122)
|
|
|
|
|
|
|
|
|
|
Notify Discord about deploy failure.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|