.gitea/workflows/deploy.yml aktualisiert
All checks were successful
Deploy Trainer_LLM to llm-node / deploy (push) Successful in 1s

This commit is contained in:
Lars 2025-08-12 13:22:31 +02:00
parent 16890af944
commit 427d3f5419

View File

@ -3,10 +3,7 @@ name: Deploy Trainer_LLM to llm-node
on:
push:
branches: [ "main" ]
paths:
- "knowledge/**"
- "llm-api/**"
- "scripts/**"
# Kein paths-Filter mehr: neue Ordner deployen sofort mit, sobald sie in DEPLOY_DIRS stehen.
concurrency:
group: deploy-trainer-llm
@ -14,65 +11,52 @@ concurrency:
jobs:
deploy:
runs-on: linux_host # muss zum Runner-Label passen
runs-on: linux_host
env:
# -> Hier trägst du ALLE zu deployenden Top-Level-Verzeichnisse ein:
# Bei neuen Ordnern einfach anhängen (durch Leerzeichen getrennt)
DEPLOY_DIRS: "knowledge llm-api scripts schemas"
TARGET_BASE: "/home/llmadmin"
steps:
- name: Checkout
# Absolute URL reduziert Abhängigkeit von DEFAULT_ACTIONS_URL
uses: https://github.com/actions/checkout@v4
- name: Sanity — Runner & Commit
run: |
echo "Runner: $RUNNER_NAME Labels: $RUNNER_LABELS"
echo "Commit: $GITEA_SHA Ref: $GITEA_REF"
echo "Commit: ${GITHUB_SHA:-$GITEA_SHA} Ref: ${GITHUB_REF:-$GITEA_REF}"
uname -a
- name: Debug whoami & write test
- name: Ensure target base exists
run: |
whoami
id
getent passwd $(whoami) || true
# Testet Schreibrecht unter /home/llmadmin
touch /home/llmadmin/.write_test && rm /home/llmadmin/.write_test || echo "no write"
install -d "$TARGET_BASE"
- name: Ensure target directories exist
- name: Deploy whitelisted directories
run: |
mkdir -p /home/llmadmin/knowledge
mkdir -p /home/llmadmin/llm-api
mkdir -p /home/llmadmin/scripts
set -euo pipefail
IFS=' ' read -r -a DIRS <<< "$DEPLOY_DIRS"
- name: Rsync knowledge/
if: ${{ hashFiles('knowledge/**') != '' }}
run: |
for d in "${DIRS[@]}"; do
if [ -d "$d" ]; then
# Nur wenn im Ordner auch Dateien/Unterordner liegen
if [ -n "$(find "$d" -mindepth 1 -print -quit)" ]; then
echo ">> Syncing $d -> $TARGET_BASE/$d"
install -d "$TARGET_BASE/$d"
rsync -a --delete \
--exclude='.git' \
--exclude='.env' --exclude='.env.*' --exclude='**/.env' --exclude='**/.env.*' \
knowledge/ /home/llmadmin/knowledge/
echo "Synced knowledge/"
- name: Rsync llm-api/
if: ${{ hashFiles('llm-api/**') != '' }}
run: |
rsync -a --delete \
--exclude='.git' \
--exclude='.env' --exclude='.env.*' --exclude='**/.env' --exclude='**/.env.*' \
llm-api/ /home/llmadmin/llm-api/
echo "Synced llm-api/"
- name: Rsync scripts/
if: ${{ hashFiles('scripts/**') != '' }}
run: |
rsync -a --delete \
--exclude='.git' \
--exclude='.env' --exclude='.env.*' --exclude='**/.env' --exclude='**/.env.*' \
scripts/ /home/llmadmin/scripts/
echo "Synced scripts/"
"$d"/ "$TARGET_BASE/$d"/
else
echo ">> Skipping $d (leer)"
fi
else
echo ">> Skipping $d (existiert nicht im Repo)"
fi
done
- name: Optional — systemctl --user restart llm-api (ignore if missing)
continue-on-error: true
env:
XDG_RUNTIME_DIR: /run/user/${{ inputs.uid || 1000 }}
run: |
# Versuche nur zu restarten, wenn der Service existiert
if systemctl --user list-unit-files | grep -q '^llm-api.service'; then
systemctl --user restart llm-api.service
systemctl --user --no-pager status llm-api.service --full -l || true
@ -80,9 +64,9 @@ jobs:
echo "llm-api.service nicht gefunden — Schritt wird übersprungen."
fi
- name: Post-check — show latest changes
- name: Post-check — list targets
run: |
echo "Deploy complete. Listing targets:"
ls -la /home/llmadmin/knowledge | tail -n +1 || true
ls -la /home/llmadmin/llm-api | tail -n +1 || true
ls -la /home/llmadmin/scripts | tail -n +1 || true
for d in $DEPLOY_DIRS; do
echo "== $TARGET_BASE/$d =="
ls -la "$TARGET_BASE/$d" 2>/dev/null | tail -n +1 || true
done