deployer/docs/contrib/ms-teams.md

183 lines
4.0 KiB
Markdown
Raw Normal View History

2020-10-02 00:11:13 +02:00
<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit contrib/ms-teams.php -->
<!-- Then run bin/docgen -->
# ms-teams
[Source](/contrib/ms-teams.php)
## Installing
Require ms-teams recipe in your `deploy.php` file:
Setup:
1. Open MS Teams
2. Navigate to Teams section
3. Select existing or create new team
4. Select existing or create new channel
5. Hover over channel to get tree dots, click, in menu select "Connectors"
6. Search for and configure "Incoming Webhook"
7. Confirm/create and copy your Webhook URL
8. Setup deploy.php
Add in header:
```php
require 'contrib/ms-teams.php';
set('teams_webhook', 'https://outlook.office.com/webhook/...');
```
Add in content:
```php
before('deploy', 'teams:notify');
2020-10-29 23:16:36 +01:00
after('deploy:success', 'teams:notify:success');
2020-10-02 00:11:13 +02:00
after('deploy:failed', 'teams:notify:failure');
```
9.) Sip your coffee
## Configuration
- `teams_webhook` teams incoming webhook url, **required**
```
set('teams_webhook', 'https://outlook.office.com/webhook/...');
```
- `teams_title` the title of application, default `{{application}}`
- `teams_text` notification message template, markdown supported
```
set('teams_text', '_{{user}}_ deploying `{{branch}}` to *{{target}}*');
```
- `teams_success_text` success template, default:
```
set('teams_success_text', 'Deploy to *{{target}}* successful');
```
- `teams_failure_text` failure template, default:
```
set('teams_failure_text', 'Deploy to *{{target}}* failed');
```
- `teams_color` color's attachment
- `teams_success_color` success color's attachment
- `teams_failure_color` failure color's attachment
## Usage
If you want to notify only about beginning of deployment add this line only:
```php
before('deploy', 'teams:notify');
```
If you want to notify about successful end of deployment add this too:
```php
2020-10-29 23:16:36 +01:00
after('deploy:success', 'teams:notify:success');
2020-10-02 00:11:13 +02:00
```
If you want to notify about failed deployment add this too:
```php
after('deploy:failed', 'teams:notify:failure');
```
2021-08-31 20:15:06 +02:00
* Configuration
* [teams_title](#teams_title)
* [teams_text](#teams_text)
* [teams_success_text](#teams_success_text)
* [teams_failure_text](#teams_failure_text)
* [teams_color](#teams_color)
* [teams_success_color](#teams_success_color)
* [teams_failure_color](#teams_failure_color)
2020-10-02 00:11:13 +02:00
* Tasks
* [teams:notify](#teamsnotify)
* [teams:notify:success](#teamsnotifysuccess)
* [teams:notify:failure](#teamsnotifyfailure)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
## Configuration
2020-10-02 00:11:13 +02:00
### teams_title
[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L78)
2020-10-02 00:11:13 +02:00
Title of project
2021-08-31 20:15:06 +02:00
2020-10-02 00:11:13 +02:00
### teams_text
[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L83)
2020-10-02 00:11:13 +02:00
Deploy message
2021-08-31 20:15:06 +02:00
```php title="Default value"
'_{{user}}_ deploying `{{branch}}` to *{{target}}*'
```
2020-10-02 00:11:13 +02:00
### teams_success_text
[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L84)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
```php title="Default value"
'Deploy to *{{target}}* successful'
```
2020-10-02 00:11:13 +02:00
### teams_failure_text
[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L85)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
```php title="Default value"
'Deploy to *{{target}}* failed'
```
2020-10-02 00:11:13 +02:00
### teams_color
[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L88)
2020-10-02 00:11:13 +02:00
Color of attachment
2021-08-31 20:15:06 +02:00
```php title="Default value"
'#4d91f7'
```
2020-10-02 00:11:13 +02:00
### teams_success_color
[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L89)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
```php title="Default value"
'#00c100'
```
2020-10-02 00:11:13 +02:00
### teams_failure_color
[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L90)
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
```php title="Default value"
'#ff0909'
```
2020-10-02 00:11:13 +02:00
## Tasks
### teams:notify
[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L93)
2020-10-02 00:11:13 +02:00
Notifying Teams
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
2020-10-02 00:11:13 +02:00
### teams:notify:success
[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L108)
2020-10-02 00:11:13 +02:00
Notifying Teams about deploy finish
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00
2020-10-02 00:11:13 +02:00
### teams:notify:failure
[Source](https://github.com/deployphp/deployer/blob/master/contrib/ms-teams.php#L123)
2020-10-02 00:11:13 +02:00
Notifying Teams about deploy failure
2020-10-02 00:11:13 +02:00
2021-08-31 20:15:06 +02:00