测试6
parent
de500f28cd
commit
41c5686ac9
|
|
@ -23,6 +23,10 @@ steps:
|
||||||
- name: notify-wecom
|
- name: notify-wecom
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Drone CI 构建状态
|
||||||
STATUS="$DRONE_BUILD_STATUS"
|
STATUS="$DRONE_BUILD_STATUS"
|
||||||
|
|
||||||
if [ "$STATUS" = "success" ]; then
|
if [ "$STATUS" = "success" ]; then
|
||||||
|
|
@ -33,16 +37,26 @@ steps:
|
||||||
COLOR="warning"
|
COLOR="warning"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -s -X POST "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=cdd97aab-d256-4f07-9145-a0a2b1555322" \
|
# 构建 JSON 数据
|
||||||
-H "Content-Type: application/json" \
|
JSON_DATA=$(cat <<EOF
|
||||||
--data-binary @- <<EOF
|
|
||||||
{
|
{
|
||||||
"msgtype": "markdown",
|
"msgtype": "markdown",
|
||||||
"markdown": {
|
"markdown": {
|
||||||
"content": "${MSG}\n> 项目:${DRONE_REPO_NAME}\n> 分支:${DRONE_BRANCH}\n> 构建号:${DRONE_BUILD_NUMBER}\n> 状态:<font color=\"${COLOR}\">${STATUS}</font>"
|
"content": "${MSG}
|
||||||
|
> 项目:${DRONE_REPO_NAME}
|
||||||
|
> 分支:${DRONE_BRANCH}
|
||||||
|
> 构建号:${DRONE_BUILD_NUMBER}
|
||||||
|
> 状态:<font color=\"${COLOR}\">${STATUS}</font>"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
# 发送企业微信通知
|
||||||
|
curl -s -X POST "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=cdd97aab-d256-4f07-9145-a0a2b1555322" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
--data-binary "$JSON_DATA"
|
||||||
|
|
||||||
when:
|
when:
|
||||||
status:
|
status:
|
||||||
- success
|
- success
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue