CI: единое TG-уведомление об успехе и авто-миграции при старте web
- Добавлен job notify_success: одно сообщение в Telegram при успешных lint+test - start-web.sh теперь выполняет check-deps и python manage.py migrate --noinput перед Gunicorn
This commit is contained in:
@@ -140,3 +140,35 @@ jobs:
|
||||
curl -fsS -X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \
|
||||
-d "chat_id=${TG_CHANNEL}" \
|
||||
--data-urlencode "text=${MSG}"
|
||||
|
||||
notify_success:
|
||||
name: Telegram Notify Success
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, test]
|
||||
if: |
|
||||
always() &&
|
||||
needs.lint.result == 'success' &&
|
||||
needs.test.result == 'success'
|
||||
env:
|
||||
TG_BOT_KEY: ${{ secrets.TG_BOT_KEY }}
|
||||
TG_CHANNEL: ${{ secrets.TG_CHANNEL }}
|
||||
steps:
|
||||
- name: Telegram notify (lint+test success)
|
||||
env:
|
||||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "${TG_BOT_KEY:-}" ] || [ -z "${TG_CHANNEL:-}" ]; then
|
||||
echo "TG_BOT_KEY or TG_CHANNEL is not set; skip telegram notification"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
MSG="✅ [mostovik-backend] lint + tests passed
|
||||
branch=${GITHUB_REF_NAME}
|
||||
sha=${GITHUB_SHA}
|
||||
actor=${GITHUB_ACTOR}
|
||||
commit=${COMMIT_MESSAGE:-n/a}"
|
||||
|
||||
curl -fsS -X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \
|
||||
-d "chat_id=${TG_CHANNEL}" \
|
||||
--data-urlencode "text=${MSG}"
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
set -eu
|
||||
|
||||
export DJANGO_SETTINGS_MODULE="${DJANGO_SETTINGS_MODULE:-settings.production}"
|
||||
export STARTUP_COMPONENT="${STARTUP_COMPONENT:-web}"
|
||||
|
||||
/app/docker/scripts/check-deps.sh
|
||||
python src/manage.py migrate --noinput
|
||||
|
||||
exec gunicorn core.wsgi:application \
|
||||
--bind "0.0.0.0:${PORT:-8000}" \
|
||||
|
||||
Reference in New Issue
Block a user