2021-09-26 15:25:58 +02:00
|
|
|
|
<!-- DO NOT EDIT THIS FILE! -->
|
|
|
|
|
<!-- Instead edit contrib/chatwork.php -->
|
|
|
|
|
<!-- Then run bin/docgen -->
|
|
|
|
|
|
2022-07-26 09:18:44 +02:00
|
|
|
|
# Chatwork Recipe
|
2021-09-26 15:25:58 +02:00
|
|
|
|
|
2022-09-12 12:29:44 +02:00
|
|
|
|
```php
|
|
|
|
|
require 'contrib/chatwork.php';
|
|
|
|
|
```
|
|
|
|
|
|
2021-09-26 15:25:58 +02:00
|
|
|
|
[Source](/contrib/chatwork.php)
|
|
|
|
|
|
|
|
|
|
|
2021-11-06 19:02:51 +01:00
|
|
|
|
|
2021-09-26 15:25:58 +02:00
|
|
|
|
# Chatwork Recipe
|
|
|
|
|
|
|
|
|
|
## Installing
|
|
|
|
|
1. Create chatwork account by any manual in the internet
|
|
|
|
|
2. Take chatwork token (Like: b29a700e2d15bef3f26ae6a5c142d1ea) and set `chatwork_token` parameter
|
|
|
|
|
3. Take chatwork room id from url after clicked on the room, and set `chatwork_room_id` parameter
|
|
|
|
|
4. If you want, you can edit `chatwork_notify_text`, `chatwork_success_text` or `chatwork_failure_text`
|
|
|
|
|
5. Require chatwork recipe in your `deploy.php` file
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
# https://deployer.org/recipes.html
|
|
|
|
|
|
|
|
|
|
require 'recipe/chatwork.php';
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Add hook on deploy:
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
before('deploy', 'chatwork:notify');
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
|
|
- `chatwork_token` – chatwork bot token, **required**
|
|
|
|
|
- `chatwork_room_id` — chatwork room to push messages to **required**
|
|
|
|
|
- `chatwork_notify_text` – notification message template
|
|
|
|
|
```
|
|
|
|
|
[info]
|
|
|
|
|
[title](*) Deployment Status: Deploying[/title]
|
|
|
|
|
Repo: {{repository}}
|
|
|
|
|
Branch: {{branch}}
|
|
|
|
|
Server: {{hostname}}
|
|
|
|
|
Release Path: {{release_path}}
|
|
|
|
|
Current Path: {{current_path}}
|
|
|
|
|
[/info]
|
|
|
|
|
```
|
|
|
|
|
- `chatwork_success_text` – success template, default:
|
|
|
|
|
```
|
|
|
|
|
[info]
|
|
|
|
|
[title](*) Deployment Status: Successfully[/title]
|
|
|
|
|
Repo: {{repository}}
|
|
|
|
|
Branch: {{branch}}
|
|
|
|
|
Server: {{hostname}}
|
|
|
|
|
Release Path: {{release_path}}
|
|
|
|
|
Current Path: {{current_path}}
|
|
|
|
|
[/info]"
|
|
|
|
|
```
|
|
|
|
|
- `chatwork_failure_text` – failure template, default:
|
|
|
|
|
```
|
|
|
|
|
[info]
|
|
|
|
|
[title](*) Deployment Status: Failed[/title]
|
|
|
|
|
Repo: {{repository}}
|
|
|
|
|
Branch: {{branch}}
|
|
|
|
|
Server: {{hostname}}
|
|
|
|
|
Release Path: {{release_path}}
|
|
|
|
|
Current Path: {{current_path}}
|
|
|
|
|
[/info]"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Tasks
|
|
|
|
|
|
|
|
|
|
- `chatwork:notify` – send message to chatwork
|
|
|
|
|
- `chatwork:notify:success` – send success message to chatwork
|
|
|
|
|
- `chatwork:notify:failure` – send failure message to chatwork
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
If you want to notify only about beginning of deployment add this line only:
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
before('deploy', 'chatwork:notify');
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
If you want to notify about successful end of deployment add this too:
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
after('success', 'chatwork:notify:success');
|
|
|
|
|
```
|
|
|
|
|
If you want to notify about failed deployment add this too:
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
after('deploy:failed', 'chatwork:notify:failure');
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
### chatwork_token
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/chatwork.php#L91)
|
|
|
|
|
|
|
|
|
|
Chatwork settings
|
2022-09-12 12:53:42 +02:00
|
|
|
|
:::info Required
|
|
|
|
|
Throws exception if not set.
|
|
|
|
|
:::
|
|
|
|
|
|
2021-09-26 15:25:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### chatwork_room_id
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/chatwork.php#L94)
|
|
|
|
|
|
|
|
|
|
|
2022-09-12 12:53:42 +02:00
|
|
|
|
:::info Required
|
|
|
|
|
Throws exception if not set.
|
|
|
|
|
:::
|
|
|
|
|
|
2021-09-26 15:25:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### chatwork_api
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/chatwork.php#L97)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-12 12:53:42 +02:00
|
|
|
|
```php title="Default value"
|
|
|
|
|
return 'https://api.chatwork.com/v2/rooms/' . get('chatwork_room_id') . '/messages';
|
|
|
|
|
```
|
2021-09-26 15:25:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### chatwork_notify_text
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/chatwork.php#L102)
|
|
|
|
|
|
|
|
|
|
The Messages
|
|
|
|
|
|
|
|
|
|
```php title="Default value"
|
|
|
|
|
"[info]\n[title](*) Deployment Status: Deploying[/title]\nRepo: {{repository}}\nBranch: {{branch}}\nServer: {{hostname}}\nRelease Path: {{release_path}}\nCurrent Path: {{current_path}}\n[/info]"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### chatwork_success_text
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/chatwork.php#L103)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```php title="Default value"
|
|
|
|
|
"[info]\n[title](*) Deployment Status: Successfully[/title]\nRepo: {{repository}}\nBranch: {{branch}}\nServer: {{hostname}}\nRelease Path: {{release_path}}\nCurrent Path: {{current_path}}\n[/info]"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### chatwork_failure_text
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/chatwork.php#L104)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```php title="Default value"
|
|
|
|
|
"[info]\n[title](*) Deployment Status: Failed[/title]\nRepo: {{repository}}\nBranch: {{branch}}\nServer: {{hostname}}\nRelease Path: {{release_path}}\nCurrent Path: {{current_path}}\n[/info]"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Tasks
|
|
|
|
|
|
|
|
|
|
### chatwork_send_message
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/chatwork.php#L107)
|
|
|
|
|
|
2021-09-26 15:43:51 +02:00
|
|
|
|
|
2021-09-26 15:25:58 +02:00
|
|
|
|
|
|
|
|
|
Helpers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### chatwork:test
|
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/chatwork.php#L116)
|
|
|
|
|
|
2021-11-08 22:59:39 +01:00
|
|
|
|
Tests messages.
|
2021-09-26 15:25:58 +02:00
|
|
|
|
|
|
|
|
|
Tasks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### chatwork:notify
|
2021-11-21 09:57:58 +00:00
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/chatwork.php#L127)
|
2021-09-26 15:25:58 +02:00
|
|
|
|
|
2021-11-08 22:59:39 +01:00
|
|
|
|
Notifies Chatwork.
|
2021-09-26 15:25:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### chatwork:notify:success
|
2021-11-21 09:57:58 +00:00
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/chatwork.php#L142)
|
2021-09-26 15:25:58 +02:00
|
|
|
|
|
2021-11-08 22:59:39 +01:00
|
|
|
|
Notifies Chatwork about deploy finish.
|
2021-09-26 15:25:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### chatwork:notify:failure
|
2021-11-21 09:57:58 +00:00
|
|
|
|
[Source](https://github.com/deployphp/deployer/blob/master/contrib/chatwork.php#L158)
|
2021-09-26 15:25:58 +02:00
|
|
|
|
|
2021-11-08 22:59:39 +01:00
|
|
|
|
Notifies Chatwork about deploy failure.
|
2021-09-26 15:25:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|