管理后台增加交易单号
This commit is contained in:
@@ -45,6 +45,7 @@ jobs:
|
||||
ls -la dist
|
||||
|
||||
- name: SSH 部署到生产机(蓝绿原子切换)
|
||||
id: deploy
|
||||
env:
|
||||
SSH_KEY: ${{ secrets.ZT_CLOSET_PROD_SSH_KEY }}
|
||||
SSH_HOST: ${{ vars.ZT_CLOSET_PROD_SSH_HOST }}
|
||||
@@ -107,22 +108,20 @@ jobs:
|
||||
if: always()
|
||||
env:
|
||||
DINGTALK_TOKEN: ${{ secrets.ZT_CLOSET_DINGTALK_TOKEN }}
|
||||
JOB_RESULT: ${{ jobs.build-and-deploy.result }}
|
||||
# 部署步骤的结论:success / failure / skipped / cancelled(部署被跳过或失败均视为失败)
|
||||
DEPLOY_OUTCOME: ${{ steps.deploy.outcome }}
|
||||
run: |
|
||||
if [ "$JOB_RESULT" = "success" ]; then
|
||||
if [ "$DEPLOY_OUTCOME" = "success" ]; then
|
||||
STATUS="✅ 前端部署成功"
|
||||
COLOR="info"
|
||||
else
|
||||
STATUS="❌ 前端部署失败"
|
||||
COLOR="warning"
|
||||
fi
|
||||
|
||||
# 单行拼装 payload:避免多行双引号转义导致 shell 语法错误;\n 交由 JSON 解析为换行
|
||||
TEXT="## 前端部署通知\n\n**结果**:${STATUS}\n\n**触发人**:${{ gitea.actor }}\n**分支/标签**:${{ gitea.ref_name }}\n**提交**:[${{ gitea.sha }}](${{ gitea.server_url }}/${{ gitea.repository }}/commit/${{ gitea.sha }})\n**流水线**:[${{ gitea.run_id }}](${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }})"
|
||||
PAYLOAD="{\"msgtype\":\"markdown\",\"markdown\":{\"title\":\"前端部署通知\",\"text\":\"${TEXT}\"}}"
|
||||
|
||||
curl -s -X POST "https://oapi.dingtalk.com/robot/send?access_token=${DINGTALK_TOKEN}" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "{
|
||||
\"msgtype\": \"markdown\",
|
||||
\"markdown\": {
|
||||
\"title\": \"前端部署通知\",
|
||||
\"text\": \"## 前端部署通知\n\n**结果**:<font color=\\\"${COLOR}\\\">${STATUS}</font>\n\n**触发人**:${{ gitea.actor }}\n**分支/标签**:${{ gitea.ref_name }}\n**提交**:[${{ gitea.sha }}](${{ gitea.server_url }}/${{ gitea.repository }}/commit/${{ gitea.sha }})\n**流水线**:[${{ gitea.run_id }}](${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }})\n"
|
||||
}
|
||||
}"
|
||||
-d "$PAYLOAD"
|
||||
echo "钉钉通知已发送:${STATUS}"
|
||||
|
||||
Reference in New Issue
Block a user