How to deploy any project using FTP with Gitlab CI? | mrkaluzny

Unsere Pipeline für einen Static Build der Landingpage (Astro)

stages:
  - build
  - deploy

# 1. Schritt: Build
build_job:
  stage: build
  image: node:alpine
  script:
    - npm install
    - npm run build
  artifacts:
    paths:
      - dist/
    expire_in: 1 hour

# 2. Schritt: Deploy
deploy_job:
  stage: deploy
  image: alpine:latest
  before_script:
    - apk add --no-cache lftp
  script:
    - lftp -c "
        set ftp:passive-mode true;
        set ftp:ssl-allow no;
        open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOST;
        mirror -Rev dist/ ./ 
        --ignore-time 
        --parallel=10 
        --exclude-glob .git* --exclude .git/;
        quit"
  only:
    - main