dektop
All checks were successful
Deploy / deploy-staging (push) Successful in 8s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-06-06 03:36:42 +02:00
parent 888981c782
commit 738b7e9975
2 changed files with 65 additions and 145 deletions

View File

@@ -11,14 +11,13 @@ jobs:
if: gitea.ref == 'refs/heads/develop'
runs-on: private-server
env:
BASE_DIRS: "src public api partials tools data debug modules"
ENSURE_DIRS: "src public api partials tools data debug modules config"
CONFIG_BASE_DIR: "config"
CONFIG_ENV_DIR: "config/staging"
DEPLOY_ENV: "staging"
LOCAL_ROOT: "/deploy/nexus/desktop"
RSYNC_OPTS: "--delete --inplace --no-whole-file --no-owner --no-group --no-perms --omit-dir-times --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r"
SITE_DOMAIN_DIR: "${{ vars.SITE_DOMAIN_DIR }}"
TARGET_PATH: "/deploy/nexus/desktop/staging/"
RSYNC_OPTS: "--delete --inplace --no-whole-file --no-owner --no-group --no-perms --omit-dir-times --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r"
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -33,96 +32,57 @@ jobs:
run: |
set -euo pipefail
if [ -z "${SITE_DOMAIN_DIR}" ]; then
echo "❌ SITE_DOMAIN_DIR ist leer."
echo " Bitte in Gitea als Repository Variable setzen."
exit 1
fi
echo "🚀 Deploy ${DEPLOY_ENV} → ${TARGET_PATH}"
echo "Deploy Domain: ${SITE_DOMAIN_DIR}"
echo "Target path: ${TARGET_PATH}"
echo "=== DEBUG: who/where ==="
hostname || true
id || true
echo "GITEA_REPOSITORY=${GITEA_REPOSITORY:-}"
echo "GITEA_REF=${GITEA_REF:-}"
echo "=== DEBUG: mount + path visibility ==="
ls -la /deploy || true
ls -la /deploy/webserver || true
df -h /deploy/webserver || true
mount | grep -E "/deploy/webserver" || true
echo "=== DEBUG: write test (pre-sync) ==="
mkdir -p "${TARGET_PATH}"
date > "${TARGET_PATH}/__ci_write_test.txt" || true
ls -la "${TARGET_PATH}" || true
cat "${TARGET_PATH}/__ci_write_test.txt" || true
echo "📁 Prüfe lokale Basisverzeichnisse..."
MISSING=0
for d in $BASE_DIRS; do
echo "🧱 Stelle lokale Standardverzeichnisse sicher..."
for d in $ENSURE_DIRS; do
if [ ! -d "$d" ]; then
echo "❌ Verzeichnis '$d/' fehlt im Repo!"
MISSING=1
echo " Erstelle fehlendes Verzeichnis: $d"
mkdir -p "$d"
fi
done
if [ ! -d "$CONFIG_BASE_DIR" ]; then
echo "❌ Basis-Konfig-Verzeichnis '$CONFIG_BASE_DIR/' fehlt!"
MISSING=1
fi
if [ ! -d "$CONFIG_ENV_DIR" ]; then
echo " Env-Konfiguration '$CONFIG_ENV_DIR/' fehlt!"
MISSING=1
echo " Erstelle fehlendes Env-Config-Verzeichnis: $CONFIG_ENV_DIR"
mkdir -p "$CONFIG_ENV_DIR"
fi
if [ "$MISSING" -ne 0 ]; then
echo "⛔ Abbruch wegen fehlender Verzeichnisse."
exit 1
fi
echo "🔁 Sync gesamtes Projekt → ${TARGET_PATH}"
rsync -a ${RSYNC_OPTS} \
--exclude=".git/***" \
--exclude=".gitea/***" \
--exclude=".ci_config_deploy/***" \
--exclude="docs/***" \
--exclude="Umsetzungsanweisung/***" \
--exclude="config/staging/***" \
--exclude="config/prod/***" \
--exclude=".gitkeep" \
./ "${TARGET_PATH}"
echo "🧱 Stelle sicher, dass Zielpfad existiert..."
mkdir -p "${TARGET_PATH}"
echo "🚀 Deploy ${DEPLOY_ENV} → ${TARGET_PATH}"
chmod -R u+rwX,go+rX "${TARGET_PATH}" || true
echo "RSYNC_OPTS: ${RSYNC_OPTS}"
for d in $BASE_DIRS; do
echo "🔁 Sync ${d}/ → ${TARGET_PATH}${d}/"
mkdir -p "${TARGET_PATH}${d}/"
rsync -a ${RSYNC_OPTS} --exclude=".gitkeep" "${d}/" "${TARGET_PATH}${d}/"
done
echo "🧩 Baue gemischtes Config-Verzeichnis (config/*.php + ${CONFIG_ENV_DIR})..."
echo "🧩 Baue gemischtes Config-Verzeichnis..."
rm -rf .ci_config_deploy
mkdir -p .ci_config_deploy
if [ -d "${CONFIG_BASE_DIR}" ]; then
for f in ${CONFIG_BASE_DIR}/*.php; do
if [ -f "$f" ]; then
echo " Basis-Config-Datei: $f"
cp "$f" .ci_config_deploy/
fi
done
fi
for f in ${CONFIG_BASE_DIR}/*.php; do
if [ -f "$f" ]; then
echo " Basis-Config-Datei: $f"
cp "$f" .ci_config_deploy/
fi
done
if [ -d "${CONFIG_ENV_DIR}" ]; then
echo " Env-Config aus ${CONFIG_ENV_DIR}/"
cp -R "${CONFIG_ENV_DIR}/." .ci_config_deploy/
fi
echo "🔁 Sync .ci_config_deploy/ → ${TARGET_PATH}${CONFIG_BASE_DIR}/"
echo "🔁 Sync Config → ${TARGET_PATH}${CONFIG_BASE_DIR}/"
mkdir -p "${TARGET_PATH}${CONFIG_BASE_DIR}/"
rsync -a ${RSYNC_OPTS} --exclude=".gitkeep" ".ci_config_deploy/" "${TARGET_PATH}${CONFIG_BASE_DIR}/"
echo "=== DEBUG: post-sync spot checks ==="
ls -la "${TARGET_PATH}" | head -n 200 || true
find "${TARGET_PATH}" -maxdepth 2 -type f | head -n 200 || true
rsync -a ${RSYNC_OPTS} \
--exclude=".gitkeep" \
".ci_config_deploy/" "${TARGET_PATH}${CONFIG_BASE_DIR}/"
echo "✅ Deploy ${DEPLOY_ENV} abgeschlossen."
@@ -130,14 +90,13 @@ jobs:
if: gitea.ref == 'refs/heads/main'
runs-on: private-server
env:
BASE_DIRS: "src public api partials tools data debug modules"
ENSURE_DIRS: "src public api partials tools data debug modules config"
CONFIG_BASE_DIR: "config"
CONFIG_ENV_DIR: "config/prod"
DEPLOY_ENV: "production"
LOCAL_ROOT: "/deploy/nexus/desktop"
RSYNC_OPTS: "--delete --inplace --no-whole-file --no-owner --no-group --no-perms --omit-dir-times --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r"
SITE_DOMAIN_DIR: "${{ vars.SITE_DOMAIN_DIR }}"
TARGET_PATH: "/deploy/nexus/desktop/live/"
RSYNC_OPTS: "--delete --inplace --no-whole-file --no-owner --no-group --no-perms --omit-dir-times --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r"
steps:
- name: Checkout
uses: actions/checkout@v4
@@ -152,95 +111,56 @@ jobs:
run: |
set -euo pipefail
if [ -z "${SITE_DOMAIN_DIR}" ]; then
echo "❌ SITE_DOMAIN_DIR ist leer."
echo " Bitte in Gitea als Repository Variable setzen."
exit 1
fi
echo "🚀 Deploy ${DEPLOY_ENV} → ${TARGET_PATH}"
echo "Deploy Domain: ${SITE_DOMAIN_DIR}"
echo "Target path: ${TARGET_PATH}"
echo "=== DEBUG: who/where ==="
hostname || true
id || true
echo "GITEA_REPOSITORY=${GITEA_REPOSITORY:-}"
echo "GITEA_REF=${GITEA_REF:-}"
echo "=== DEBUG: mount + path visibility ==="
ls -la /deploy || true
ls -la /deploy/webserver || true
df -h /deploy/webserver || true
mount | grep -E "/deploy/webserver" || true
echo "=== DEBUG: write test (pre-sync) ==="
mkdir -p "${TARGET_PATH}"
date > "${TARGET_PATH}/__ci_write_test.txt" || true
ls -la "${TARGET_PATH}" || true
cat "${TARGET_PATH}/__ci_write_test.txt" || true
echo "📁 Prüfe lokale Basisverzeichnisse..."
MISSING=0
for d in $BASE_DIRS; do
echo "🧱 Stelle lokale Standardverzeichnisse sicher..."
for d in $ENSURE_DIRS; do
if [ ! -d "$d" ]; then
echo "❌ Verzeichnis '$d/' fehlt im Repo!"
MISSING=1
echo " Erstelle fehlendes Verzeichnis: $d"
mkdir -p "$d"
fi
done
if [ ! -d "$CONFIG_BASE_DIR" ]; then
echo "❌ Basis-Konfig-Verzeichnis '$CONFIG_BASE_DIR/' fehlt!"
MISSING=1
fi
if [ ! -d "$CONFIG_ENV_DIR" ]; then
echo " Env-Konfiguration '$CONFIG_ENV_DIR/' fehlt!"
MISSING=1
echo " Erstelle fehlendes Env-Config-Verzeichnis: $CONFIG_ENV_DIR"
mkdir -p "$CONFIG_ENV_DIR"
fi
if [ "$MISSING" -ne 0 ]; then
echo "⛔ Abbruch wegen fehlender Verzeichnisse."
exit 1
fi
echo "🔁 Sync gesamtes Projekt → ${TARGET_PATH}"
rsync -a ${RSYNC_OPTS} \
--exclude=".git/***" \
--exclude=".gitea/***" \
--exclude=".ci_config_deploy/***" \
--exclude="docs/***" \
--exclude="Umsetzungsanweisung/***" \
--exclude="config/staging/***" \
--exclude="config/prod/***" \
--exclude=".gitkeep" \
./ "${TARGET_PATH}"
echo "🧱 Stelle sicher, dass Zielpfad existiert..."
mkdir -p "${TARGET_PATH}"
echo "🚀 Deploy ${DEPLOY_ENV} → ${TARGET_PATH}"
chmod -R u+rwX,go+rX "${TARGET_PATH}" || true
echo "RSYNC_OPTS: ${RSYNC_OPTS}"
for d in $BASE_DIRS; do
echo "🔁 Sync ${d}/ → ${TARGET_PATH}${d}/"
mkdir -p "${TARGET_PATH}${d}/"
rsync -a ${RSYNC_OPTS} --exclude=".gitkeep" "${d}/" "${TARGET_PATH}${d}/"
done
echo "🧩 Baue gemischtes Config-Verzeichnis (config/*.php + ${CONFIG_ENV_DIR})..."
echo "🧩 Baue gemischtes Config-Verzeichnis..."
rm -rf .ci_config_deploy
mkdir -p .ci_config_deploy
if [ -d "${CONFIG_BASE_DIR}" ]; then
for f in ${CONFIG_BASE_DIR}/*.php; do
if [ -f "$f" ]; then
echo " Basis-Config-Datei: $f"
cp "$f" .ci_config_deploy/
fi
done
fi
for f in ${CONFIG_BASE_DIR}/*.php; do
if [ -f "$f" ]; then
echo " Basis-Config-Datei: $f"
cp "$f" .ci_config_deploy/
fi
done
if [ -d "${CONFIG_ENV_DIR}" ]; then
echo " Env-Config aus ${CONFIG_ENV_DIR}/"
cp -R "${CONFIG_ENV_DIR}/." .ci_config_deploy/
fi
echo "🔁 Sync .ci_config_deploy/ → ${TARGET_PATH}${CONFIG_BASE_DIR}/"
echo "🔁 Sync Config → ${TARGET_PATH}${CONFIG_BASE_DIR}/"
mkdir -p "${TARGET_PATH}${CONFIG_BASE_DIR}/"
rsync -a ${RSYNC_OPTS} --exclude=".gitkeep" ".ci_config_deploy/" "${TARGET_PATH}${CONFIG_BASE_DIR}/"
echo "=== DEBUG: post-sync spot checks ==="
ls -la "${TARGET_PATH}" | head -n 200 || true
find "${TARGET_PATH}" -maxdepth 2 -type f | head -n 200 || true
rsync -a ${RSYNC_OPTS} \
--exclude=".gitkeep" \
".ci_config_deploy/" "${TARGET_PATH}${CONFIG_BASE_DIR}/"
echo "✅ Deploy ${DEPLOY_ENV} abgeschlossen."