50 lines
1.2 KiB
YAML
50 lines
1.2 KiB
YAML
name: Deploy repository
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: rezeptfinder-runner
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Sync to /opt/rezept_finder
|
|
run: |
|
|
rsync -a --delete \
|
|
--exclude .git \
|
|
--exclude .gitea \
|
|
--exclude .env \
|
|
--exclude venv \
|
|
--exclude .venv \
|
|
--exclude node_modules \
|
|
./ /opt/rezept_finder/
|
|
|
|
- name: Prepare Python venv
|
|
run: |
|
|
python3 -m venv /opt/rezept_finder/venv || true
|
|
/opt/rezept_finder/venv/bin/pip install --upgrade pip
|
|
/opt/rezept_finder/venv/bin/pip install -r /opt/rezept_finder/backend/requirements.txt
|
|
|
|
- name: Build frontend
|
|
working-directory: /opt/rezept_finder/frontend
|
|
run: |
|
|
npm install
|
|
npm run build
|
|
|
|
- name: Sync frontend
|
|
working-directory: /opt/rezept_finder/frontend
|
|
run: rsync -a --delete dist/ /var/www/frontend/
|
|
|
|
- name: Restart API
|
|
run: |
|
|
sudo systemctl restart flask-api
|
|
sudo systemctl reload nginx
|
|
|
|
|