Add deployment workflow
All checks were successful
Deploy to Server / deploy (push) Successful in 10s

This commit is contained in:
Joakim Hellsén 2026-02-21 23:34:36 +01:00
commit 5e8b4abe2b
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk
2 changed files with 32 additions and 21 deletions

32
.github/workflows/deploy.yaml vendored Normal file
View file

@ -0,0 +1,32 @@
name: Deploy to Server
# EDITOR=nvim visudo
# forgejo-runner ALL=(ttvdrops) NOPASSWD: /usr/bin/git
# forgejo-runner ALL=(root) NOPASSWD: /bin/systemctl restart ttvdrops
# forgejo-runner ALL=(ttvdrops) NOPASSWD: /usr/bin/uv run python /home/ttvdrops/ttvdrops/manage.py migrate
# forgejo-runner ALL=(ttvdrops) NOPASSWD: /usr/bin/uv sync -U
on:
push:
pull_request:
workflow_dispatch:
jobs:
deploy:
runs-on: self-hosted
env:
DJANGO_DEBUG: False
DJANGO_SECRET_KEY: 1234567890
steps:
- uses: actions/checkout@v6
- run: uv sync --all-extras --dev
- run: uv run pytest
- name: Deploy to Server
if: ${{ success() }}
run: |
sudo -u ttvdrops git -C /home/ttvdrops/ttvdrops pull
sudo -u ttvdrops uv sync -U
sudo -u ttvdrops uv run python /home/ttvdrops/ttvdrops/manage.py migrate
sudo systemctl restart ttvdrops

View file

@ -1,21 +0,0 @@
name: Run Pytest
on:
push:
pull_request:
schedule:
- cron: "0 14 * * 0" # Run weekly at 14:00 UTC
workflow_dispatch:
jobs:
test:
runs-on: self-hosted
env:
DJANGO_DEBUG: False
DJANGO_SECRET_KEY: 1234567890
steps:
- uses: actions/checkout@v6
- run: uv sync --all-extras --dev
- run: uv run pytest