All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 3s
51 lines
1.7 KiB
YAML
51 lines
1.7 KiB
YAML
# .gitea/workflows/deploy.yml
|
||
name: Deploy mindnet to llm-node
|
||
on: { push: { branches: [ "main" ] } }
|
||
# on: {}
|
||
|
||
concurrency: { group: deploy-mindnet, cancel-in-progress: false }
|
||
|
||
jobs:
|
||
deploy:
|
||
runs-on: linux_host
|
||
env:
|
||
DEPLOY_DIRS: "app scripts schemas docker requirements.txt README.md"
|
||
TARGET_BASE: "/home/llmadmin/mindnet"
|
||
steps:
|
||
- name: Checkout
|
||
uses: https://github.com/actions/checkout@v4
|
||
- name: Ensure target base
|
||
run: install -d "$TARGET_BASE"
|
||
- name: Deploy whitelisted
|
||
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='.env.*' --exclude='**/.env*' \
|
||
"$d"/ "$TARGET_BASE/$d"/
|
||
else
|
||
rsync -a "$d" "$TARGET_BASE/$d"
|
||
fi
|
||
fi
|
||
done
|
||
- name: Python venv (idempotent)
|
||
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: Optional — 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
|