This commit is contained in:
2026-03-06 23:49:26 +01:00
parent c540d8d0aa
commit c0adcdd45a

View File

@@ -2,6 +2,7 @@ stages:
- deploy - deploy
variables: variables:
# CONFIG wird separat gemischt und nach /config synchronisiert
BASE_DIRS: "api data debug modules partials public src tools" BASE_DIRS: "api data debug modules partials public src tools"
CONFIG_BASE_DIR: "config" CONFIG_BASE_DIR: "config"
LOCAL_ROOT: "/mnt/nexusserver" LOCAL_ROOT: "/mnt/nexusserver"
@@ -36,16 +37,17 @@ default:
echo "🚀 Deploy ${DEPLOY_ENV} → ${TARGET_PATH}" echo "🚀 Deploy ${DEPLOY_ENV} → ${TARGET_PATH}"
# --- Sync base dirs --- # --- Sync Workspace (ohne config/) ---
for d in $BASE_DIRS; do echo "🔁 Sync Workspace → ${TARGET_PATH} (ohne config/)"
if [ -d "$d" ]; then rsync -a --delete \
echo "🔁 Sync ${d}/ → ${TARGET_PATH}${d}/" --exclude=".git" \
mkdir -p "${TARGET_PATH}${d}/" --exclude=".ci_config_deploy" \
rsync -a --delete --exclude=".gitkeep" "${d}/" "${TARGET_PATH}${d}/" --exclude="config/" \
else --exclude=".gitlab-ci.yml" \
echo "⚠️ Verzeichnis $d existiert nicht im Repo, überspringe Sync." --exclude="README.md" \
fi --exclude="PROJECT_CONTEXT.md" \
done --exclude=".gitkeep" \
"./" "${TARGET_PATH}"
# --- Build mixed config --- # --- Build mixed config ---
echo "🧩 Baue gemischtes Config-Verzeichnis (config/*.php + ${CONFIG_ENV_DIR})..." echo "🧩 Baue gemischtes Config-Verzeichnis (config/*.php + ${CONFIG_ENV_DIR})..."
@@ -62,6 +64,10 @@ default:
cp -R "${CONFIG_ENV_DIR}/." .ci_config_deploy/ cp -R "${CONFIG_ENV_DIR}/." .ci_config_deploy/
fi fi
# --- Ensure env subdirs are removed on target ---
echo "🧹 Entferne ${TARGET_PATH}${CONFIG_BASE_DIR}/prod und /staging falls vorhanden..."
rm -rf "${TARGET_PATH}${CONFIG_BASE_DIR}/prod" "${TARGET_PATH}${CONFIG_BASE_DIR}/staging"
echo "🔁 Sync .ci_config_deploy/ → ${TARGET_PATH}${CONFIG_BASE_DIR}/" echo "🔁 Sync .ci_config_deploy/ → ${TARGET_PATH}${CONFIG_BASE_DIR}/"
mkdir -p "${TARGET_PATH}${CONFIG_BASE_DIR}/" mkdir -p "${TARGET_PATH}${CONFIG_BASE_DIR}/"
rsync -a --delete --exclude=".gitkeep" ".ci_config_deploy/" "${TARGET_PATH}${CONFIG_BASE_DIR}/" rsync -a --delete --exclude=".gitkeep" ".ci_config_deploy/" "${TARGET_PATH}${CONFIG_BASE_DIR}/"