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