deployer/docs/contrib/workplace.md

149 lines
3.1 KiB
Markdown
Raw Normal View History

2021-09-26 15:25:58 +02:00
<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit contrib/workplace.php -->
<!-- Then run bin/docgen -->
# workplace
[Source](/contrib/workplace.php)
2021-11-06 19:02:51 +01:00
2021-09-26 15:25:58 +02:00
## Installing
This recipes works with Custom Integrations and Publishing Bots.
Require the new recipe into your `deploy.php`
```php
require 'contrib/workplace.php';
```
Add hook on deploy:
```
before('deploy', 'workplace:notify');
```
## Configuration
- `workplace_webhook` - incoming workplace webhook **required**
```
// With custom integration
set('workplace_webhook', 'https://graph.facebook.com/<GROUP_ID>/feed?access_token=<ACCESS_TOKEN>');
// With publishing bot
set('workplace_webhook', 'https://graph.facebook.com/v3.0/group/feed?access_token=<ACCESS_TOKEN>');
// Use markdown on message
set('workplace_webhook', 'https://graph.facebook.com/<GROUP_ID>/feed?access_token=<ACCESS_TOKEN>&formatting=MARKDOWN');
```
- `workplace_text` - notification message
```
set('workplace_text', '_{{user}}_ deploying `{{branch}}` to *{{target}}*');
```
- `workplace_success_text` success template, default:
```
set('workplace_success_text', 'Deploy to *{{target}}* successful');
```
- `workplace_failure_text` failure template, default:
```
set('workplace_failure_text', 'Deploy to *{{target}}* failed');
```
- `workplace_edit_post` whether to create a new post for deploy result, or edit the first one created, default creates a new post:
```
set('workplace_edit_post', false);
```
## Usage
If you want to notify only about beginning of deployment add this line only:
```php
before('deploy', 'workplace:notify');
```
If you want to notify about successful end of deployment add this too:
```php
after('deploy:success', 'workplace:notify:success');
```
If you want to notify about failed deployment add this too:
```php
after('deploy:failed', 'workplace:notify:failure');
```
## Configuration
### workplace_text
[Source](https://github.com/deployphp/deployer/blob/master/contrib/workplace.php#L77)
Deploy message
```php title="Default value"
'_{{user}}_ deploying `{{branch}}` to *{{target}}*'
```
### workplace_success_text
[Source](https://github.com/deployphp/deployer/blob/master/contrib/workplace.php#L78)
```php title="Default value"
'Deploy to *{{target}}* successful'
```
### workplace_failure_text
[Source](https://github.com/deployphp/deployer/blob/master/contrib/workplace.php#L79)
```php title="Default value"
'Deploy to *{{target}}* failed'
```
### workplace_edit_post
[Source](https://github.com/deployphp/deployer/blob/master/contrib/workplace.php#L82)
By default, create a new post for every message
```php title="Default value"
false
```
## Tasks
### workplace:notify
[Source](https://github.com/deployphp/deployer/blob/master/contrib/workplace.php#L85)
Notifying Workplace.
### workplace:notify:success
[Source](https://github.com/deployphp/deployer/blob/master/contrib/workplace.php#L110)
Notifying Workplace about deploy finish.
### workplace:notify:failure
[Source](https://github.com/deployphp/deployer/blob/master/contrib/workplace.php#L122)
Notifying Workplace about deploy failure.