Add migration check and server health check to deployment workflow
All checks were successful
Deploy to Server / deploy (push) Successful in 15s

This commit is contained in:
Joakim Hellsén 2026-03-17 21:58:45 +01:00
commit 2bb4407ebe
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk

View file

@ -23,10 +23,22 @@ jobs:
- uses: actions/checkout@v6 - uses: actions/checkout@v6
- run: uv sync --all-extras --dev -U - run: uv sync --all-extras --dev -U
- run: uv run pytest - 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 - name: Deploy to Server
if: ${{ success() }} if: ${{ success() && github.ref == 'refs/heads/master' }}
run: | run: |
sudo -u ttvdrops git -C /home/ttvdrops/ttvdrops pull 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 -u ttvdrops uv run python /home/ttvdrops/ttvdrops/manage.py migrate
sudo systemctl restart ttvdrops sudo systemctl restart ttvdrops
- name: Check if server is up
run: |
sleep 2
curl -f https://ttvdrops.lovinator.space/ || exit 1