chore: update CI and deployment workflows for improved notifications and permissions

- Upgraded the upload-artifact action from v3 to v4 in CI workflow for better performance.
- Added a notification step in the CI workflow to send test results via Telegram, including job status and repository details.
- Modified the deployment workflow to ensure correct file permissions before and after code updates.
- Renamed the deployment notification step for clarity and included a link to the action run details in the message.
This commit is contained in:
2026-01-25 15:35:56 +03:00
parent dd8b1c02a4
commit 3ee72ec48a
2 changed files with 33 additions and 6 deletions

View File

@@ -1,9 +1,7 @@
name: Deploy to Production
on:
push:
branches: [ main ]
workflow_dispatch: # Позволяет запускать вручную
workflow_dispatch: # Только ручной запуск
jobs:
deploy:
@@ -34,9 +32,16 @@ jobs:
# Обновляем код
echo "📥 Pulling latest changes..."
# Исправляем права на файлы перед обновлением
sudo chown -R deploy:deploy /home/prod || true
git fetch origin main
git reset --hard origin/main
# Устанавливаем правильные права после обновления
sudo chown -R deploy:deploy /home/prod || true
# Проверяем, что изменения есть
NEW_COMMIT=$(git rev-parse HEAD)
if [ "$CURRENT_COMMIT" = "$NEW_COMMIT" ]; then
@@ -50,6 +55,7 @@ jobs:
if command -v make &> /dev/null; then
make restart || docker-compose restart
else
cd /home/prod
docker-compose down
docker-compose up -d --build
fi
@@ -90,7 +96,7 @@ jobs:
echo "✅ All health checks passed"
- name: Send notification (optional)
- name: Send deployment notification
if: always()
uses: appleboy/telegram-action@v1.0.0
with:
@@ -105,4 +111,6 @@ jobs:
Author: ${{ github.actor }}
${{ job.status == 'success' && '✅ Deployment successful!' || '❌ Deployment failed!' }}
continue-on-error: true # Не падаем, если уведомление не отправилось
View details: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
continue-on-error: true