feat(ci): add rollback mechanism and Telegram notifications
CI/CD Pipeline Improvement - Add automated rollback on deployment failure and Telegram notifications for CI/deploy status. Changes: - scripts/deploy-prod.sh: Add rollback_save_image(), rollback_restore_image(), and telegram_notify() functions - scripts/deploy-prod.sh: Save current Docker image before building new one - scripts/deploy-prod.sh: Rollback to previous image on health check failure - .gitea/workflows/ci.yaml: Add Telegram notifications for CI failures - memento-note/eslint.config.mjs: Disable experimental React Compiler rules Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -60,12 +60,60 @@ jobs:
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
|
||||
- name: Notify lint failure
|
||||
if: failure()
|
||||
env:
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
|
||||
run: |
|
||||
if [ -n "$TELEGRAM_BOT_TOKEN" ] && [ -n "$TELEGRAM_CHAT_ID" ]; then
|
||||
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
|
||||
-d "chat_id=${TELEGRAM_CHAT_ID}" \
|
||||
-d "text=❌ Momento CI Failed
|
||||
Step: Lint
|
||||
Commit: ${{ github.sha }}
|
||||
Branch: ${{ github.ref_name }}" \
|
||||
-d "parse_mode=Markdown" || true
|
||||
fi
|
||||
|
||||
- name: Unit tests
|
||||
run: npm run test:unit
|
||||
|
||||
- name: Notify test failure
|
||||
if: failure()
|
||||
env:
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
|
||||
run: |
|
||||
if [ -n "$TELEGRAM_BOT_TOKEN" ] && [ -n "$TELEGRAM_CHAT_ID" ]; then
|
||||
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
|
||||
-d "chat_id=${TELEGRAM_CHAT_ID}" \
|
||||
-d "text=❌ Momento CI Failed
|
||||
Step: Unit Tests
|
||||
Commit: ${{ github.sha }}
|
||||
Branch: ${{ github.ref_name }}" \
|
||||
-d "parse_mode=Markdown" || true
|
||||
fi
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Notify build failure
|
||||
if: failure()
|
||||
env:
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
|
||||
run: |
|
||||
if [ -n "$TELEGRAM_BOT_TOKEN" ] && [ -n "$TELEGRAM_CHAT_ID" ]; then
|
||||
curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" \
|
||||
-d "chat_id=${TELEGRAM_CHAT_ID}" \
|
||||
-d "text=❌ Momento CI Failed
|
||||
Step: Build
|
||||
Commit: ${{ github.sha }}
|
||||
Branch: ${{ github.ref_name }}" \
|
||||
-d "parse_mode=Markdown" || true
|
||||
fi
|
||||
|
||||
- name: Pack web artifact for deploy
|
||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
||||
working-directory: memento-note
|
||||
|
||||
Reference in New Issue
Block a user