fix: ci/cd telegram notification

This commit is contained in:
2025-06-19 21:44:08 +03:00
parent 5da5154315
commit c0e89ab918

View File

@@ -23,6 +23,43 @@ jobs:
with: with:
push: true push: true
tags: smallbuster/fire-exam:latest tags: smallbuster/fire-exam:latest
- name: Notify Telegram start building
if: always()
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: |
🚀 Стадия сборки запущена!
Сервер: ${{ secrets.SERVER_NAME }}
Репозиторий: ${{ github.repository }}
- name: Notify Telegram about success
if: success()
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: |
✅ Сборка успешно завершена!
Сервер: ${{ secrets.SERVER_NAME }}
Репозиторий: ${{ github.repository }}
Ветка: ${{ github.ref_name }}
Коммит: ${{ github.sha }}
- name: Notify Telegram about failure
if: failure()
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: |
❌ Сборка проекта неудачна!
Сервер: ${{ secrets.SERVER_NAME }}
Репозиторий: ${{ github.repository }}
Ветка: ${{ github.ref_name }}
Коммит: ${{ github.sha }}
Подробности: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
deploy: deploy:
runs-on: self-hosted runs-on: self-hosted
needs: build needs: build
@@ -52,6 +89,17 @@ jobs:
run: | run: |
docker compose -f docker-compose.yaml up -d docker compose -f docker-compose.yaml up -d
- name: Notify Telegram start building
if: always()
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: |
🐳 Стадия деплоя запущена!
Сервер: ${{ secrets.SERVER_NAME }}
Репозиторий: ${{ github.repository }}
- name: Notify Telegram about success - name: Notify Telegram about success
if: success() if: success()
uses: appleboy/telegram-action@master uses: appleboy/telegram-action@master
@@ -60,11 +108,10 @@ jobs:
token: ${{ secrets.TELEGRAM_BOT_TOKEN }} token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: | message: |
✅ Деплой успешно завершен! ✅ Деплой успешно завершен!
Сервер: ${{ secrets.SERVER_NAME }}
Репозиторий: ${{ github.repository }} Репозиторий: ${{ github.repository }}
Ветка: ${{ github.ref }} Ветка: ${{ github.ref_name }}
Коммит: ${{ github.sha }} Коммит: ${{ github.sha }}
Сервер: ${{ secrets.SERVER_IP }}
Путь: ${{ secrets.DEPLOY_PATH }}
- name: Notify Telegram about failure - name: Notify Telegram about failure
if: failure() if: failure()
@@ -74,7 +121,8 @@ jobs:
token: ${{ secrets.TELEGRAM_BOT_TOKEN }} token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
message: | message: |
❌ Деплой не удался! ❌ Деплой не удался!
Сервер: ${{ secrets.SERVER_NAME }}
Репозиторий: ${{ github.repository }} Репозиторий: ${{ github.repository }}
Ветка: ${{ github.ref }} Ветка: ${{ github.ref_name }}
Коммит: ${{ github.sha }} Коммит: ${{ github.sha }}
Подробности: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} Подробности: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}