mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-24 09:12:51 +01:00
207 lines
4.2 KiB
Markdown
207 lines
4.2 KiB
Markdown
<!-- DO NOT EDIT THIS FILE! -->
|
||
<!-- Instead edit contrib/slack.php -->
|
||
<!-- Then run bin/docgen -->
|
||
|
||
# slack
|
||
|
||
[Source](/contrib/slack.php)
|
||
|
||
|
||
## Installing
|
||
|
||
<a href="https://slack.com/oauth/authorize?&client_id=113734341365.225973502034&scope=incoming-webhook"><img alt="Add to Slack" height="40" width="139" src="https://platform.slack-edge.com/img/add_to_slack.png" srcset="https://platform.slack-edge.com/img/add_to_slack.png 1x, https://platform.slack-edge.com/img/add_to_slack@2x.png 2x" /></a>
|
||
|
||
Require slack recipe in your `deploy.php` file:
|
||
|
||
```php
|
||
require 'contrib/slack.php';
|
||
```
|
||
|
||
Add hook on deploy:
|
||
|
||
```php
|
||
before('deploy', 'slack:notify');
|
||
```
|
||
|
||
## Configuration
|
||
|
||
- `slack_webhook` – slack incoming webhook url, **required**
|
||
```
|
||
set('slack_webhook', 'https://hooks.slack.com/...');
|
||
```
|
||
- `slack_channel` - channel to send notification to. The default is the channel configured in the webhook
|
||
- `slack_title` – the title of application, default `{{application}}`
|
||
- `slack_text` – notification message template, markdown supported
|
||
```
|
||
set('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
|
||
|
||
## Usage
|
||
|
||
If you want to notify only about beginning of deployment add this line only:
|
||
|
||
```php
|
||
before('deploy', 'slack:notify');
|
||
```
|
||
|
||
If you want to notify about successful end of deployment add this too:
|
||
|
||
```php
|
||
after('deploy:success', 'slack:notify:success');
|
||
```
|
||
|
||
If you want to notify about failed deployment add this too:
|
||
|
||
```php
|
||
after('deploy:failed', 'slack:notify:failure');
|
||
```
|
||
|
||
|
||
|
||
|
||
## Configuration
|
||
### slack_channel
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/slack.php#L71)
|
||
|
||
Channel to publish to, when false the default channel the webhook will be used
|
||
|
||
```php title="Default value"
|
||
false
|
||
```
|
||
|
||
|
||
### slack_title
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/slack.php#L74)
|
||
|
||
Title of project
|
||
|
||
|
||
|
||
### slack_text
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/slack.php#L79)
|
||
|
||
Deploy message
|
||
|
||
```php title="Default value"
|
||
'_{{user}}_ deploying `{{target}}` to *{{hostname}}*'
|
||
```
|
||
|
||
|
||
### slack_success_text
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/slack.php#L80)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
'Deploy to *{{target}}* successful'
|
||
```
|
||
|
||
|
||
### slack_failure_text
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/slack.php#L81)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
'Deploy to *{{target}}* failed'
|
||
```
|
||
|
||
|
||
### slack_rollback_text
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/slack.php#L82)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
'_{{user}}_ rolled back changes on *{{target}}*'
|
||
```
|
||
|
||
|
||
### slack_color
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/slack.php#L85)
|
||
|
||
Color of attachment
|
||
|
||
```php title="Default value"
|
||
'#4d91f7'
|
||
```
|
||
|
||
|
||
### slack_success_color
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/slack.php#L86)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
'#00c100'
|
||
```
|
||
|
||
|
||
### slack_failure_color
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/slack.php#L87)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
'#ff0909'
|
||
```
|
||
|
||
|
||
### slack_rollback_color
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/slack.php#L88)
|
||
|
||
|
||
|
||
```php title="Default value"
|
||
'#eba211'
|
||
```
|
||
|
||
|
||
|
||
## Tasks
|
||
|
||
### slack:notify
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/slack.php#L100)
|
||
|
||
Notifying Slack.
|
||
|
||
|
||
|
||
|
||
### slack:notify:success
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/slack.php#L120)
|
||
|
||
Notifying Slack about deploy finish.
|
||
|
||
|
||
|
||
|
||
### slack:notify:failure
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/slack.php#L140)
|
||
|
||
Notifying Slack about deploy failure.
|
||
|
||
|
||
|
||
|
||
### slack:notify:rollback
|
||
[Source](https://github.com/deployphp/deployer/blob/master/contrib/slack.php#L160)
|
||
|
||
Notifying Slack about rollback.
|
||
|
||
|
||
|
||
|