From 29682d870b54abf6a9062921252ce019b29ecab9 Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 1 Sep 2025 13:53:07 +0200 Subject: [PATCH] .gitea/workflows/deploy.yml aktualisiert --- .gitea/workflows/deploy.yml | 72 +++++++++---------------------------- 1 file changed, 16 insertions(+), 56 deletions(-) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index b5a3514..b81ef7e 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -1,88 +1,48 @@ +# .gitea/workflows/deploy.yml name: Deploy mindnet to llm-node - -on: - push: - branches: [ "main" ] - -concurrency: - group: deploy-mindnet - cancel-in-progress: false +on: { push: { branches: [ "main" ] } } +concurrency: { group: deploy-mindnet, cancel-in-progress: false } jobs: deploy: runs-on: linux_host env: - # >>> Alle zu deployenden Top-Level-Verzeichnisse/Dateien hier pflegen <<< - # (Neue Ordner einfach anhängen; werden 1:1 nach $TARGET_BASE gespiegelt.) - DEPLOY_DIRS: "app scripts docker requirements.txt README.md" + DEPLOY_DIRS: "app scripts requirements.txt README.md" TARGET_BASE: "/home/llmadmin/mindnet" steps: - name: Checkout uses: https://github.com/actions/checkout@v4 - - - name: Sanity — Runner & Commit - run: | - echo "Runner: $RUNNER_NAME Labels: $RUNNER_LABELS" - echo "Commit: ${GITHUB_SHA:-$GITEA_SHA} Ref: ${GITHUB_REF:-$GITEA_REF}" - uname -a - - - name: Ensure target base exists - run: | - install -d "$TARGET_BASE" - - - name: Deploy whitelisted directories + - 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 - if [ -n "$(find "$d" -mindepth 1 -print -quit)" ]; then - echo ">> Syncing DIR $d -> $TARGET_BASE/$d" - install -d "$TARGET_BASE/$d" - rsync -a --delete \ - --exclude='.git' \ - --exclude='.env' --exclude='.env.*' --exclude='**/.env' --exclude='**/.env.*' \ - "$d"/ "$TARGET_BASE/$d"/ - else - echo ">> Skipping $d (leer)" - fi + install -d "$TARGET_BASE/$d" + rsync -a --delete --exclude='.git' \ + --exclude='.env' --exclude='.env.*' --exclude='**/.env*' \ + "$d"/ "$TARGET_BASE/$d"/ else - echo ">> Copying FILE $d -> $TARGET_BASE/$d" rsync -a "$d" "$TARGET_BASE/$d" fi - else - echo ">> Skipping $d (nicht vorhanden im Repo)" fi done - - - name: Python venv prepare (idempotent) + - name: Python venv (idempotent) run: | - set -euo pipefail cd "$TARGET_BASE" - if [ ! -d ".venv" ]; then - python3 -m venv .venv - fi + [ -d .venv ] || python3 -m venv .venv source .venv/bin/activate pip install --upgrade pip - if [ -f "requirements.txt" ]; then - pip install -r requirements.txt - fi - - - name: Optional — systemctl --user restart mindnet-api (ignore if missing) + [ -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 gefunden — Schritt wird übersprungen." + echo "mindnet-api.service nicht vorhanden – übersprungen." fi - - - name: Post-check — list targets - run: | - for d in $DEPLOY_DIRS; do - echo "== $TARGET_BASE/$d ==" - ls -la "$TARGET_BASE/$d" 2>/dev/null | tail -n +1 || true - done