Update deploy.yml

This commit is contained in:
Vaica committed 2026-06-25 15:57:45 +08:00
1 parent d73c30cdb1
commit 27067de5bc
1 file changed
+72 -62
+72 -62
View File
@@ -550,20 +550,18 @@ jobs:
FILE_COUNT="${{ needs.build.outputs.file_count }}"
TOTAL_SIZE="${{ needs.build.outputs.total_size }}"
EDGEONE_DETAIL=""
if [ "$EDGEONE_DEPLOYED" = "true" ]; then
EDGEONE_DOWNLOAD="${{ needs.deploy-edgeone.outputs.download_duration }}"
EDGEONE_UPLOAD="${{ needs.deploy-edgeone.outputs.upload_duration }}"
EDGEONE_DETAIL=$'\n - 下载: '"${EDGEONE_DOWNLOAD}"'s\n - 上传: '"${EDGEONE_UPLOAD}"'s'
else
EDGEONE_DETAIL=""
EDGEONE_DETAIL=$(printf "\n - 下载: %ss\n - 上传: %ss" "$EDGEONE_DOWNLOAD" "$EDGEONE_UPLOAD")
fi
UPYUN_DETAIL=""
if [ "$UPYUN_DEPLOYED" = "true" ]; then
UPYUN_DOWNLOAD="${{ needs.deploy-upyun.outputs.download_duration }}"
UPYUN_UPLOAD="${{ needs.deploy-upyun.outputs.upload_duration }}"
UPYUN_DETAIL=$'\n - 下载: '"${UPYUN_DOWNLOAD}"'s\n - 上传: '"${UPYUN_UPLOAD}"'s'
else
UPYUN_DETAIL=""
UPYUN_DETAIL=$(printf "\n - 下载: %ss\n - 上传: %ss" "$UPYUN_DOWNLOAD" "$UPYUN_UPLOAD")
fi
if [ "${{ steps.deploy-status.outputs.any_deployed }}" = "true" ]; then
@@ -572,29 +570,26 @@ jobs:
TITLE="ℹ️ **无变化,跳过部署**"
fi
CURRENT_TIME=$(date +'%Y-%m-%d %H:%M:%S')
MESSAGE="$TITLE
📦 项目: ${{ github.repository }}
🌿 分支: ${{ github.ref_name }}
🔗 Commit: ${{ github.sha }}
🕐 时间: $CURRENT_TIME
📊 构建统计:
- 文件总数: $FILE_COUNT
- 总大小: $TOTAL_SIZE
⏱️ 耗时统计:
- Pre-check: ${PRECHECK_DUR}s
- Build: ${BUILD_DUR}s
- EdgeOne: ${EDGEONE_DUR}s${EDGEONE_DETAIL}
- UpYun: ${UPYUN_DUR}s${UPYUN_DETAIL}
🔍 查看详情: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
MESSAGE=$(printf "%s\n\n📦 项目: %s\n🌿 分支: %s\n🔗 Commit: %s\n🕐 时间: %s\n\n📊 构建统计:\n- 文件总数: %s\n- 总大小: %s\n\n⏱️ 耗时统计:\n- Pre-check: %ss\n- Build: %ss\n- EdgeOne: %ss%s\n- UpYun: %ss%s\n\n🔍 查看详情: https://github.com/%s/actions/runs/%s" \
"$TITLE" \
"${{ github.repository }}" \
"${{ github.ref_name }}" \
"${{ github.sha }}" \
"$(date +'%Y-%m-%d %H:%M:%S')" \
"$FILE_COUNT" \
"$TOTAL_SIZE" \
"$PRECHECK_DUR" \
"$BUILD_DUR" \
"$EDGEONE_DUR" \
"$EDGEONE_DETAIL" \
"$UPYUN_DUR" \
"$UPYUN_DETAIL" \
"${{ github.repository }}" \
"${{ github.run_id }}")
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
-d chat_id="${TELEGRAM_CHAT_ID}" \
-d text="${MESSAGE}" \
-d text="$MESSAGE" \
-d parse_mode="Markdown"
- name: Send Feishu notification with detailed timing
@@ -615,20 +610,18 @@ jobs:
FILE_COUNT="${{ needs.build.outputs.file_count }}"
TOTAL_SIZE="${{ needs.build.outputs.total_size }}"
EDGEONE_DETAIL=""
if [ "$EDGEONE_DEPLOYED" = "true" ]; then
EDGEONE_DOWNLOAD="${{ needs.deploy-edgeone.outputs.download_duration }}"
EDGEONE_UPLOAD="${{ needs.deploy-edgeone.outputs.upload_duration }}"
EDGEONE_DETAIL="\n - 下载: ${EDGEONE_DOWNLOAD}s\n - 上传: ${EDGEONE_UPLOAD}s"
else
EDGEONE_DETAIL=""
EDGEONE_DETAIL=$(printf "\n - 下载: %ss\n - 上传: %ss" "$EDGEONE_DOWNLOAD" "$EDGEONE_UPLOAD")
fi
UPYUN_DETAIL=""
if [ "$UPYUN_DEPLOYED" = "true" ]; then
UPYUN_DOWNLOAD="${{ needs.deploy-upyun.outputs.download_duration }}"
UPYUN_UPLOAD="${{ needs.deploy-upyun.outputs.upload_duration }}"
UPYUN_DETAIL="\n - 下载: ${UPYUN_DOWNLOAD}s\n - 上传: ${UPYUN_UPLOAD}s"
else
UPYUN_DETAIL=""
UPYUN_DETAIL=$(printf "\n - 下载: %ss\n - 上传: %ss" "$UPYUN_DOWNLOAD" "$UPYUN_UPLOAD")
fi
if [ "${{ steps.deploy-status.outputs.any_deployed }}" = "true" ]; then
@@ -637,15 +630,29 @@ jobs:
TITLE="ℹ️ **无变化,跳过部署**"
fi
CURRENT_TIME=$(date +'%Y-%m-%d %H:%M:%S')
MESSAGE_TEXT="$TITLE"$'\n\n'"📦 项目: ${{ github.repository }}"$'\n'"🌿 分支: ${{ github.ref_name }}"$'\n'"🔗 Commit: ${{ github.sha }}"$'\n'"🕐 时间: ${CURRENT_TIME}"$'\n\n'"📊 构建统计:"$'\n'"- 文件总数: ${FILE_COUNT}"$'\n'"- 总大小: ${TOTAL_SIZE}"$'\n\n'"⏱️ 耗时统计:"$'\n'"- Pre-check: ${PRECHECK_DUR}s"$'\n'"- Build: ${BUILD_DUR}s"$'\n'"- EdgeOne: ${EDGEONE_DUR}s${EDGEONE_DETAIL}"$'\n'"- UpYun: ${UPYUN_DUR}s${UPYUN_DETAIL}"$'\n\n'"🔍 查看详情: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
MESSAGE_TEXT=$(printf "%s\n\n📦 项目: %s\n🌿 分支: %s\n🔗 Commit: %s\n🕐 时间: %s\n\n📊 构建统计:\n- 文件总数: %s\n- 总大小: %s\n\n⏱️ 耗时统计:\n- Pre-check: %ss\n- Build: %ss\n- EdgeOne: %ss%s\n- UpYun: %ss%s\n\n🔍 查看详情: https://github.com/%s/actions/runs/%s" \
"$TITLE" \
"${{ github.repository }}" \
"${{ github.ref_name }}" \
"${{ github.sha }}" \
"$(date +'%Y-%m-%d %H:%M:%S')" \
"$FILE_COUNT" \
"$TOTAL_SIZE" \
"$PRECHECK_DUR" \
"$BUILD_DUR" \
"$EDGEONE_DUR" \
"$EDGEONE_DETAIL" \
"$UPYUN_DUR" \
"$UPYUN_DETAIL" \
"${{ github.repository }}" \
"${{ github.run_id }}")
curl -s -X POST "${FEISHU_WEBHOOK_URL}" \
curl -s -X POST "$FEISHU_WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d "{
\"msg_type\": \"text\",
\"content\": {
\"text\": \"${MESSAGE_TEXT}\"
\"text\": \"$MESSAGE_TEXT\"
}
}"
@@ -790,27 +797,24 @@ jobs:
fi
FAILURES=""
if [ "${{ needs.pre-check.result }}" = "failure" ]; then FAILURES="${FAILURES}"$'\n'"- ❌ Pre-check"; fi
if [ "${{ needs.build.result }}" = "failure" ]; then FAILURES="${FAILURES}"$'\n'"- ❌ Build"; fi
if [ "${{ needs.deploy-edgeone.result }}" = "failure" ]; then FAILURES="${FAILURES}"$'\n'"- ❌ Deploy EdgeOne"; fi
if [ "${{ needs.deploy-upyun.result }}" = "failure" ]; then FAILURES="${FAILURES}"$'\n'"- ❌ Deploy UpYun"; fi
if [ "${{ needs.finalize.result }}" = "failure" ]; then FAILURES="${FAILURES}"$'\n'"- ❌ Finalize"; fi
if [ "${{ needs.pre-check.result }}" = "failure" ]; then FAILURES=$(printf "%s\n- ❌ Pre-check" "$FAILURES"); fi
if [ "${{ needs.build.result }}" = "failure" ]; then FAILURES=$(printf "%s\n- ❌ Build" "$FAILURES"); fi
if [ "${{ needs.deploy-edgeone.result }}" = "failure" ]; then FAILURES=$(printf "%s\n- ❌ Deploy EdgeOne" "$FAILURES"); fi
if [ "${{ needs.deploy-upyun.result }}" = "failure" ]; then FAILURES=$(printf "%s\n- ❌ Deploy UpYun" "$FAILURES"); fi
if [ "${{ needs.finalize.result }}" = "failure" ]; then FAILURES=$(printf "%s\n- ❌ Finalize" "$FAILURES"); fi
CURRENT_TIME=$(date +'%Y-%m-%d %H:%M:%S')
MESSAGE="❌ **部署失败**
📦 项目: ${{ github.repository }}
🌿 分支: ${{ github.ref_name }}
🔗 Commit: ${{ github.sha }}
🕐 时间: $CURRENT_TIME
⚠️ 失败阶段:$FAILURES
🔍 查看详情: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
MESSAGE=$(printf "❌ **部署失败**\n\n📦 项目: %s\n🌿 分支: %s\n🔗 Commit: %s\n🕐 时间: %s\n\n⚠️ 失败阶段:%s\n\n🔍 查看详情: https://github.com/%s/actions/runs/%s" \
"${{ github.repository }}" \
"${{ github.ref_name }}" \
"${{ github.sha }}" \
"$(date +'%Y-%m-%d %H:%M:%S')" \
"$FAILURES" \
"${{ github.repository }}" \
"${{ github.run_id }}")
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
-d chat_id="${TELEGRAM_CHAT_ID}" \
-d text="${MESSAGE}" \
-d text="$MESSAGE" \
-d parse_mode="Markdown"
- name: Send Feishu failure notification
@@ -823,20 +827,26 @@ jobs:
fi
FAILURES=""
if [ "${{ needs.pre-check.result }}" = "failure" ]; then FAILURES="${FAILURES}"$'\n'"- ❌ Pre-check"; fi
if [ "${{ needs.build.result }}" = "failure" ]; then FAILURES="${FAILURES}"$'\n'"- ❌ Build"; fi
if [ "${{ needs.deploy-edgeone.result }}" = "failure" ]; then FAILURES="${FAILURES}"$'\n'"- ❌ Deploy EdgeOne"; fi
if [ "${{ needs.deploy-upyun.result }}" = "failure" ]; then FAILURES="${FAILURES}"$'\n'"- ❌ Deploy UpYun"; fi
if [ "${{ needs.finalize.result }}" = "failure" ]; then FAILURES="${FAILURES}"$'\n'"- ❌ Finalize"; fi
if [ "${{ needs.pre-check.result }}" = "failure" ]; then FAILURES=$(printf "%s\n- ❌ Pre-check" "$FAILURES"); fi
if [ "${{ needs.build.result }}" = "failure" ]; then FAILURES=$(printf "%s\n- ❌ Build" "$FAILURES"); fi
if [ "${{ needs.deploy-edgeone.result }}" = "failure" ]; then FAILURES=$(printf "%s\n- ❌ Deploy EdgeOne" "$FAILURES"); fi
if [ "${{ needs.deploy-upyun.result }}" = "failure" ]; then FAILURES=$(printf "%s\n- ❌ Deploy UpYun" "$FAILURES"); fi
if [ "${{ needs.finalize.result }}" = "failure" ]; then FAILURES=$(printf "%s\n- ❌ Finalize" "$FAILURES"); fi
CURRENT_TIME=$(date +'%Y-%m-%d %H:%M:%S')
MESSAGE_TEXT="❌ **部署失败**"$'\n\n'"📦 项目: ${{ github.repository }}"$'\n'"🌿 分支: ${{ github.ref_name }}"$'\n'"🔗 Commit: ${{ github.sha }}"$'\n'"🕐 时间: ${CURRENT_TIME}"$'\n\n'"⚠️ 失败阶段:${FAILURES}"$'\n\n'"🔍 查看详情: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
MESSAGE_TEXT=$(printf "❌ **部署失败**\n\n📦 项目: %s\n🌿 分支: %s\n🔗 Commit: %s\n🕐 时间: %s\n\n⚠️ 失败阶段:%s\n\n🔍 查看详情: https://github.com/%s/actions/runs/%s" \
"${{ github.repository }}" \
"${{ github.ref_name }}" \
"${{ github.sha }}" \
"$(date +'%Y-%m-%d %H:%M:%S')" \
"$FAILURES" \
"${{ github.repository }}" \
"${{ github.run_id }}")
curl -s -X POST "${FEISHU_WEBHOOK_URL}" \
curl -s -X POST "$FEISHU_WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d "{
\"msg_type\": \"text\",
\"content\": {
\"text\": \"${MESSAGE_TEXT}\"
\"text\": \"$MESSAGE_TEXT\"
}
}"