From b72c6db922f5b263de18e5ab60005abc16847e89 Mon Sep 17 00:00:00 2001 From: SinusFox Date: Mon, 14 Oct 2024 20:09:17 +0000 Subject: [PATCH] Update .gitlab-ci.yml --- .gitlab-ci.yml | 87 ++++++++++++-------------------------------------- 1 file changed, 20 insertions(+), 67 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 31a3920..1774977 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,67 +1,20 @@ -# Define the stages of the pipeline -stages: - - install - - build - - test - - deploy - -# Job to install dependencies -install_dependencies: - stage: install - image: node:20 - script: - - npm ci - cache: - paths: - - node_modules/ - # Run automatically on PRs to main - only: - - merge_requests - - main - # Allow manual execution - when: manual - -# Job to build the Next.js project -build_nextjs: - stage: build - image: node:20 - script: - - npm run build - dependencies: - - install_dependencies - cache: - paths: - - .next/ - # Run automatically on PRs to main - only: - - merge_requests - - main - # Allow manual execution - when: manual - -# Job to run tests -run_tests: - stage: test - image: node:20 - script: - - npm test # Replace with your test command (e.g. jest) - dependencies: - - install_dependencies - # Run automatically on PRs to main - only: - - merge_requests - - main - # Allow manual execution - when: manual - -# Deploy step (runs only on merge to main) -deploy: - stage: deploy - script: - - mkdir public - - cp -r .next/* public # Example for GitLab Pages, adjust as needed - # Only run on merge to main branch - only: - - main - # Allow manual execution - when: manual +image: node:20 + +# Cache für schnellere Builds +cache: + paths: + - node_modules/ + - .next/cache/ + +before_script: + - npm ci + +pages: + script: + - npm run build + - npm run export # Export für statische Seiten + artifacts: + paths: + - out # Das 'out'-Verzeichnis, wenn 'next export' verwendet wird + rules: + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH \ No newline at end of file -- 2.52.0