mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-22 16:27:39 +01:00
4.6 KiB
4.6 KiB
Chatwork Recipe
require 'contrib/chatwork.php';
Chatwork Recipe
Installing
- Create chatwork account by any manual in the internet
- Take chatwork token (Like: b29a700e2d15bef3f26ae6a5c142d1ea) and set
chatwork_token
parameter - Take chatwork room id from url after clicked on the room, and set
chatwork_room_id
parameter - If you want, you can edit
chatwork_notify_text
,chatwork_success_text
orchatwork_failure_text
- Require chatwork recipe in your
deploy.php
file
# https://deployer.org/recipes.html
require 'recipe/chatwork.php';
Add hook on deploy:
before('deploy', 'chatwork:notify');
Configuration
chatwork_token
– chatwork bot token, requiredchatwork_room_id
— chatwork room to push messages to requiredchatwork_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 chatworkchatwork:notify:success
– send success message to chatworkchatwork:notify:failure
– send failure message to chatwork
Usage
If you want to notify only about beginning of deployment add this line only:
before('deploy', 'chatwork:notify');
If you want to notify about successful end of deployment add this too:
after('success', 'chatwork:notify:success');
If you want to notify about failed deployment add this too:
after('deploy:failed', 'chatwork:notify:failure');
Configuration
chatwork_token
Chatwork settings :::info Required Throws exception if not set. :::
chatwork_room_id
:::info Required Throws exception if not set. :::
chatwork_api
return 'https://api.chatwork.com/v2/rooms/' . get('chatwork_room_id') . '/messages';
chatwork_notify_text
The Messages
"[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
"[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
"[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
Helpers
chatwork:test
Tests messages.
Tasks
chatwork:notify
Notifies Chatwork.
chatwork:notify:success
Notifies Chatwork about deploy finish.
chatwork:notify:failure
Notifies Chatwork about deploy failure.