mindnet/.gitea/workflows/deploy.yml
Lars d5b2e9bb8f
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s
.gitea/workflows/deploy.yml aktualisiert
2025-11-07 09:37:02 +01:00

70 lines
2.0 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# .gitea/workflows/deploy.yml
name: Deploy mindnet to llm-node
on:
push:
branches: ["main"]
concurrency:
group: deploy-mindnet
cancel-in-progress: false
jobs:
deploy:
runs-on: linux_host
env:
TARGET_BASE: /home/llmadmin/mindnet
DEPLOY_DIRS: "app scripts schemas docker tests config requirements.txt README.md"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Ensure target base exists
run: install -d "$TARGET_BASE"
- name: Stop API (graceful)
continue-on-error: true
run: |
if systemctl --user list-unit-files | grep -q '^mindnet-api.service'; then
systemctl --user stop mindnet-api.service || true
fi
- name: Deploy whitelisted (rsync)
run: |
set -euo pipefail
IFS=' ' read -r -a DIRS <<< "$DEPLOY_DIRS"
for d in "${DIRS[@]}"; do
if [ -e "$d" ]; then
if [ -d "$d" ]; then
install -d "$TARGET_BASE/$d"
rsync -a --delete \
--exclude='.git' \
--exclude='.env*' \
--exclude='.venv' \
--exclude='hf_cache' --exclude='hf_cache/**' \
"$d"/ "$TARGET_BASE/$d"/
else
rsync -a "$d" "$TARGET_BASE/$d"
fi
fi
done
- name: Python venv & requirements
run: |
cd "$TARGET_BASE"
[ -d .venv ] || python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
[ -f requirements.txt ] && pip install -r requirements.txt || true
- name: Start/Restart mindnet-api
continue-on-error: true
run: |
if systemctl --user list-unit-files | grep -q '^mindnet-api.service'; then
systemctl --user restart mindnet-api.service
systemctl --user --no-pager status mindnet-api.service --full -l || true
else
echo "mindnet-api.service nicht vorhanden übersprungen."
fi