.gitea/workflows/deploy.yml aktualisiert
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 2s
All checks were successful
Deploy mindnet to llm-node / deploy (push) Successful in 2s
This commit is contained in:
parent
6fafd61897
commit
29682d870b
|
|
@ -1,88 +1,48 @@
|
||||||
|
# .gitea/workflows/deploy.yml
|
||||||
name: Deploy mindnet to llm-node
|
name: Deploy mindnet to llm-node
|
||||||
|
on: { push: { branches: [ "main" ] } }
|
||||||
on:
|
concurrency: { group: deploy-mindnet, cancel-in-progress: false }
|
||||||
push:
|
|
||||||
branches: [ "main" ]
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: deploy-mindnet
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: linux_host
|
runs-on: linux_host
|
||||||
env:
|
env:
|
||||||
# >>> Alle zu deployenden Top-Level-Verzeichnisse/Dateien hier pflegen <<<
|
DEPLOY_DIRS: "app scripts requirements.txt README.md"
|
||||||
# (Neue Ordner einfach anhängen; werden 1:1 nach $TARGET_BASE gespiegelt.)
|
|
||||||
DEPLOY_DIRS: "app scripts docker requirements.txt README.md"
|
|
||||||
TARGET_BASE: "/home/llmadmin/mindnet"
|
TARGET_BASE: "/home/llmadmin/mindnet"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: https://github.com/actions/checkout@v4
|
uses: https://github.com/actions/checkout@v4
|
||||||
|
- name: Ensure target base
|
||||||
- name: Sanity — Runner & Commit
|
run: install -d "$TARGET_BASE"
|
||||||
run: |
|
- name: Deploy whitelisted
|
||||||
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
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
IFS=' ' read -r -a DIRS <<< "$DEPLOY_DIRS"
|
IFS=' ' read -r -a DIRS <<< "$DEPLOY_DIRS"
|
||||||
|
|
||||||
for d in "${DIRS[@]}"; do
|
for d in "${DIRS[@]}"; do
|
||||||
if [ -e "$d" ]; then
|
if [ -e "$d" ]; then
|
||||||
if [ -d "$d" ]; then
|
if [ -d "$d" ]; then
|
||||||
if [ -n "$(find "$d" -mindepth 1 -print -quit)" ]; then
|
install -d "$TARGET_BASE/$d"
|
||||||
echo ">> Syncing DIR $d -> $TARGET_BASE/$d"
|
rsync -a --delete --exclude='.git' \
|
||||||
install -d "$TARGET_BASE/$d"
|
--exclude='.env' --exclude='.env.*' --exclude='**/.env*' \
|
||||||
rsync -a --delete \
|
"$d"/ "$TARGET_BASE/$d"/
|
||||||
--exclude='.git' \
|
|
||||||
--exclude='.env' --exclude='.env.*' --exclude='**/.env' --exclude='**/.env.*' \
|
|
||||||
"$d"/ "$TARGET_BASE/$d"/
|
|
||||||
else
|
|
||||||
echo ">> Skipping $d (leer)"
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
echo ">> Copying FILE $d -> $TARGET_BASE/$d"
|
|
||||||
rsync -a "$d" "$TARGET_BASE/$d"
|
rsync -a "$d" "$TARGET_BASE/$d"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo ">> Skipping $d (nicht vorhanden im Repo)"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
- name: Python venv (idempotent)
|
||||||
- name: Python venv prepare (idempotent)
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
|
||||||
cd "$TARGET_BASE"
|
cd "$TARGET_BASE"
|
||||||
if [ ! -d ".venv" ]; then
|
[ -d .venv ] || python3 -m venv .venv
|
||||||
python3 -m venv .venv
|
|
||||||
fi
|
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
if [ -f "requirements.txt" ]; then
|
[ -f requirements.txt ] && pip install -r requirements.txt || true
|
||||||
pip install -r requirements.txt
|
- name: Optional — restart mindnet-api
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Optional — systemctl --user restart mindnet-api (ignore if missing)
|
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
if systemctl --user list-unit-files | grep -q '^mindnet-api.service'; then
|
if systemctl --user list-unit-files | grep -q '^mindnet-api.service'; then
|
||||||
systemctl --user restart mindnet-api.service
|
systemctl --user restart mindnet-api.service
|
||||||
systemctl --user --no-pager status mindnet-api.service --full -l || true
|
systemctl --user --no-pager status mindnet-api.service --full -l || true
|
||||||
else
|
else
|
||||||
echo "mindnet-api.service nicht gefunden — Schritt wird übersprungen."
|
echo "mindnet-api.service nicht vorhanden – übersprungen."
|
||||||
fi
|
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
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user