All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s
70 lines
2.0 KiB
YAML
70 lines
2.0 KiB
YAML
# .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
|