Update .gitlab-ci.yml file
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
# -----------------------------------------
|
||||||
|
# USBcheck.it – GitLab CI/CD Pipeline
|
||||||
|
# Build: pnpm
|
||||||
|
# Deploy: FTPS (lftp) → all-inkl
|
||||||
|
# -----------------------------------------
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- install
|
- install
|
||||||
- build
|
- build
|
||||||
@@ -7,7 +13,9 @@ variables:
|
|||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
BUILD_DIR: dist
|
BUILD_DIR: dist
|
||||||
|
|
||||||
# Gemeinsames pnpm-Setup für alle Node-Jobs
|
# -----------------------------------------
|
||||||
|
# Gemeinsames Setup für Node + pnpm
|
||||||
|
# -----------------------------------------
|
||||||
.node_pnpm: &node_pnpm
|
.node_pnpm: &node_pnpm
|
||||||
image: node:20-bullseye
|
image: node:20-bullseye
|
||||||
before_script:
|
before_script:
|
||||||
@@ -16,13 +24,17 @@ variables:
|
|||||||
- corepack prepare pnpm@9.12.0 --activate
|
- corepack prepare pnpm@9.12.0 --activate
|
||||||
- pnpm -v
|
- pnpm -v
|
||||||
|
|
||||||
# Cache node_modules für schnellere Builds
|
# -----------------------------------------
|
||||||
|
# Cache für node_modules
|
||||||
|
# -----------------------------------------
|
||||||
cache:
|
cache:
|
||||||
key: ${CI_COMMIT_REF_SLUG}
|
key: ${CI_COMMIT_REF_SLUG}
|
||||||
paths:
|
paths:
|
||||||
- node_modules/
|
- node_modules/
|
||||||
|
|
||||||
# 1) Dependencies installieren
|
# -----------------------------------------
|
||||||
|
# 1. Install dependencies
|
||||||
|
# -----------------------------------------
|
||||||
install:
|
install:
|
||||||
stage: install
|
stage: install
|
||||||
<<: *node_pnpm
|
<<: *node_pnpm
|
||||||
@@ -34,10 +46,14 @@ install:
|
|||||||
- node_modules/
|
- node_modules/
|
||||||
expire_in: 1h
|
expire_in: 1h
|
||||||
|
|
||||||
# 2) Build erzeugen
|
# -----------------------------------------
|
||||||
|
# 2. Build project
|
||||||
|
# -----------------------------------------
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
<<: *node_pnpm
|
<<: *node_pnpm
|
||||||
|
dependencies:
|
||||||
|
- install
|
||||||
script:
|
script:
|
||||||
- echo "🏗️ Building..."
|
- echo "🏗️ Building..."
|
||||||
- pnpm build
|
- pnpm build
|
||||||
@@ -47,17 +63,23 @@ build:
|
|||||||
- ${BUILD_DIR}/
|
- ${BUILD_DIR}/
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
|
|
||||||
# 3) Template für FTPS-Deploy (lftp)
|
# -----------------------------------------
|
||||||
|
# 3. Template für FTPS Deployment
|
||||||
|
# -----------------------------------------
|
||||||
.deploy_ftps_template: &deploy_ftps
|
.deploy_ftps_template: &deploy_ftps
|
||||||
stage: deploy
|
stage: deploy
|
||||||
image: alpine:3.20
|
image: alpine:3.20
|
||||||
|
dependencies:
|
||||||
|
- build # <<< sehr wichtig: Lade Build-Artefakte
|
||||||
before_script:
|
before_script:
|
||||||
- echo "📡 Installing lftp..."
|
- echo "📡 Installing lftp..."
|
||||||
- apk add --no-cache lftp
|
- apk add --no-cache lftp
|
||||||
script:
|
script:
|
||||||
- echo "🚀 Deploy via FTPS to $FTP_HOST:$FTP_PATH ..."
|
- echo "🚀 Deploy via FTPS to $FTP_HOST:$FTP_PATH ..."
|
||||||
- lftp -e "
|
- lftp -e "
|
||||||
|
set ftp:ssl-force true;
|
||||||
set ftp:passive-mode true;
|
set ftp:passive-mode true;
|
||||||
|
set ftp:ssl-protect-data true;
|
||||||
set ssl:verify-certificate no;
|
set ssl:verify-certificate no;
|
||||||
open -u $FTP_USER,$FTP_PASSWORD $FTP_HOST;
|
open -u $FTP_USER,$FTP_PASSWORD $FTP_HOST;
|
||||||
mirror -R --delete --parallel=4 ${BUILD_DIR}/ $FTP_PATH;
|
mirror -R --delete --parallel=4 ${BUILD_DIR}/ $FTP_PATH;
|
||||||
@@ -65,7 +87,9 @@ build:
|
|||||||
"
|
"
|
||||||
- echo "✅ Deploy finished."
|
- echo "✅ Deploy finished."
|
||||||
|
|
||||||
# 3a) Staging-Deployment
|
# -----------------------------------------
|
||||||
|
# 3a. Staging Deployment
|
||||||
|
# -----------------------------------------
|
||||||
deploy:staging:
|
deploy:staging:
|
||||||
<<: *deploy_ftps
|
<<: *deploy_ftps
|
||||||
variables:
|
variables:
|
||||||
@@ -77,7 +101,9 @@ deploy:staging:
|
|||||||
- develop
|
- develop
|
||||||
- merge_requests
|
- merge_requests
|
||||||
|
|
||||||
# 3b) Production-Deployment
|
# -----------------------------------------
|
||||||
|
# 3b. Production Deployment
|
||||||
|
# -----------------------------------------
|
||||||
deploy:production:
|
deploy:production:
|
||||||
<<: *deploy_ftps
|
<<: *deploy_ftps
|
||||||
variables:
|
variables:
|
||||||
|
|||||||
Reference in New Issue
Block a user