LoginSignup
3
0

More than 5 years have passed since last update.

deployerでデプロイ完了時にうまるちゃんがSlackに通知してくれる様にした

Posted at

deployerでデプロイ時に通知する様にした

deploy/deploy.php
task('slack_alert', function() {
    //どの環境にデプロイしているのか取得
    $stage = input()->getArgument('stage');
    //デプロイ先ディレクトリ
    $path   = run('pwd');
    $result = run('echo "phocaseデプロイ完了したよ〜"');
    //メンションをつける、 @hereを使いたい場合は特殊な書き方となり <!here> と記述します
    $team = "@hogehoge";
    $message = '\"'.$team.$path.":".$stage."環境に".$result.'\"';
    $command = 'curl -s -S -X POST --data-urlencode "payload={\"link_names\" : 1, \"channel\": \"#送信チャンネル名\", \"username\": \"umaru\", \"icon_emoji\": \":umaru:\", \"text\": '.$message.' }" "slackのweb hook APIのキーをここに記述" >/dev/null';
    run($command);
});
after('deploy', 'slack_alert');

※うまるちゃんのアイコンは各自入れてください。。。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0