From 2bb4407ebe7647c2d5eaf84c33c11a76f34b5dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Helle=C5=9Ben?= Date: Tue, 17 Mar 2026 21:58:45 +0100 Subject: [PATCH] Add migration check and server health check to deployment workflow --- .github/workflows/deploy.yaml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 648b85a..ba53108 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -23,10 +23,22 @@ jobs: - uses: actions/checkout@v6 - run: uv sync --all-extras --dev -U - run: uv run pytest + - name: Check if makemigrations are needed + run: | + if uv run python manage.py makemigrations --check --dry-run; then + echo "No migrations needed." + else + echo "Migrations needed. Please create and commit migrations before deploying." + exit 1 + fi - name: Deploy to Server - if: ${{ success() }} + if: ${{ success() && github.ref == 'refs/heads/master' }} run: | sudo -u ttvdrops git -C /home/ttvdrops/ttvdrops pull - sudo -u ttvdrops uv sync -U + sudo -u ttvdrops uv sync -U --all-extras --dev --directory /home/ttvdrops/ttvdrops sudo -u ttvdrops uv run python /home/ttvdrops/ttvdrops/manage.py migrate sudo systemctl restart ttvdrops + - name: Check if server is up + run: | + sleep 2 + curl -f https://ttvdrops.lovinator.space/ || exit 1