Last active
August 15, 2017 09:41
-
-
Save ichi/0425cc62b29a20fac5e7d1b7f4a78c23 to your computer and use it in GitHub Desktop.
circleciのdeploy前後に通知する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
case "$1" in | |
"start" ) | |
title="Started deploying to $2!" | |
title_link="${CIRCLE_BUILD_URL}" | |
text="<$3|$2>へのdeployを開始します..." | |
fallback="$2へのdeployを開始します" | |
color="#28d7e5" | |
;; | |
"finish" ) | |
title="Finished deploying to $2!" | |
title_link="${CIRCLE_BUILD_URL}" | |
text="<$3|$2>へのdeployが完了しました!" | |
fallback="$2へのdeployが完了しました!" | |
color="#28d7e5" | |
;; | |
* ) | |
exit 1; | |
;; | |
esac | |
cat << EOS | curl -XPOST ${SLACK_WEBHOOK_URL} -d @- | |
{ | |
"attachments": [ | |
{ | |
"title": "${title}", | |
"title_link": "${title_link}", | |
"text": "${text}", | |
"fallback": "${fallback}", | |
"color": "${color}" | |
} | |
] | |
} | |
EOS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment