Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -38,3 +38,10 @@ jobs:
|
|||||||
EC2_HOST: ${{ secrets.EC2_HOST }}
|
EC2_HOST: ${{ secrets.EC2_HOST }}
|
||||||
EC2_USER: ${{ secrets.EC2_USER }}
|
EC2_USER: ${{ secrets.EC2_USER }}
|
||||||
run: sh scripts/ci/deploy.sh "${{ gitea.ref_name }}"
|
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 }}"
|
||||||
|
|||||||
Executable
+24
@@ -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})"
|
||||||
Reference in New Issue
Block a user