feat(deploy): 部署完成后发送 Telegram 通知
Deploy / deploy (push) Failing after 48s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-05-24 23:09:09 +08:00
parent 53f56ce086
commit b69c23c88a
2 changed files with 31 additions and 0 deletions
+7
View File
@@ -38,3 +38,10 @@ jobs:
EC2_HOST: ${{ secrets.EC2_HOST }}
EC2_USER: ${{ secrets.EC2_USER }}
run: sh scripts/ci/deploy.sh "${{ gitea.ref_name }}"
- name: Notify
if: always()
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
run: sh scripts/ci/notify.sh "${{ gitea.ref_name }}" "${{ job.status }}"
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
# notify.sh <tag> <status> — send Telegram deploy notification
set -euo pipefail
TAG="$1"
STATUS="$2"
if [ "$STATUS" = "success" ]; then
ICON="✅"
LABEL="部署成功"
else
ICON="❌"
LABEL="部署失败"
fi
MSG="${ICON} 岩美 ${TAG} ${LABEL}
https://jiu.51yanmei.com"
curl -sf -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/sendMessage" \
-d "chat_id=${TELEGRAM_CHAT_ID}" \
--data-urlencode "text=${MSG}" \
> /dev/null
echo "==> notify: sent to Telegram (${STATUS})"