From 8fa24f0db7317f00163914260588f2ecfe968d71 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Thu, 13 Nov 2025 01:02:02 +0100 Subject: [PATCH] Update .gitlab-ci.yml file --- .gitlab-ci.yml | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50ab2b4..00203d9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,9 @@ +# ----------------------------------------- +# USBcheck.it – GitLab CI/CD Pipeline +# Build: pnpm +# Deploy: FTPS (lftp) → all-inkl +# ----------------------------------------- + stages: - install - build @@ -7,7 +13,9 @@ variables: NODE_ENV: production BUILD_DIR: dist -# Gemeinsames pnpm-Setup für alle Node-Jobs +# ----------------------------------------- +# Gemeinsames Setup für Node + pnpm +# ----------------------------------------- .node_pnpm: &node_pnpm image: node:20-bullseye before_script: @@ -16,13 +24,17 @@ variables: - corepack prepare pnpm@9.12.0 --activate - pnpm -v -# Cache node_modules für schnellere Builds +# ----------------------------------------- +# Cache für node_modules +# ----------------------------------------- cache: key: ${CI_COMMIT_REF_SLUG} paths: - node_modules/ -# 1) Dependencies installieren +# ----------------------------------------- +# 1. Install dependencies +# ----------------------------------------- install: stage: install <<: *node_pnpm @@ -34,10 +46,14 @@ install: - node_modules/ expire_in: 1h -# 2) Build erzeugen +# ----------------------------------------- +# 2. Build project +# ----------------------------------------- build: stage: build <<: *node_pnpm + dependencies: + - install script: - echo "🏗️ Building..." - pnpm build @@ -47,17 +63,23 @@ build: - ${BUILD_DIR}/ expire_in: 1 week -# 3) Template für FTPS-Deploy (lftp) +# ----------------------------------------- +# 3. Template für FTPS Deployment +# ----------------------------------------- .deploy_ftps_template: &deploy_ftps stage: deploy image: alpine:3.20 + dependencies: + - build # <<< sehr wichtig: Lade Build-Artefakte before_script: - echo "📡 Installing lftp..." - apk add --no-cache lftp script: - echo "🚀 Deploy via FTPS to $FTP_HOST:$FTP_PATH ..." - lftp -e " + set ftp:ssl-force true; set ftp:passive-mode true; + set ftp:ssl-protect-data true; set ssl:verify-certificate no; open -u $FTP_USER,$FTP_PASSWORD $FTP_HOST; mirror -R --delete --parallel=4 ${BUILD_DIR}/ $FTP_PATH; @@ -65,7 +87,9 @@ build: " - echo "✅ Deploy finished." -# 3a) Staging-Deployment +# ----------------------------------------- +# 3a. Staging Deployment +# ----------------------------------------- deploy:staging: <<: *deploy_ftps variables: @@ -77,7 +101,9 @@ deploy:staging: - develop - merge_requests -# 3b) Production-Deployment +# ----------------------------------------- +# 3b. Production Deployment +# ----------------------------------------- deploy:production: <<: *deploy_ftps variables: