Update .gitlab-ci.yml #64
+15
-62
@@ -1,67 +1,20 @@
|
|||||||
# Define the stages of the pipeline
|
image: node:20
|
||||||
stages:
|
|
||||||
- install
|
|
||||||
- build
|
|
||||||
- test
|
|
||||||
- deploy
|
|
||||||
|
|
||||||
# Job to install dependencies
|
# Cache für schnellere Builds
|
||||||
install_dependencies:
|
cache:
|
||||||
stage: install
|
paths:
|
||||||
image: node:20
|
- node_modules/
|
||||||
script:
|
- .next/cache/
|
||||||
- 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
|
before_script:
|
||||||
build_nextjs:
|
- npm ci
|
||||||
stage: build
|
|
||||||
image: node:20
|
pages:
|
||||||
script:
|
script:
|
||||||
- npm run build
|
- npm run build
|
||||||
dependencies:
|
- npm run export # Export für statische Seiten
|
||||||
- install_dependencies
|
artifacts:
|
||||||
cache:
|
|
||||||
paths:
|
paths:
|
||||||
- .next/
|
- out # Das 'out'-Verzeichnis, wenn 'next export' verwendet wird
|
||||||
# Run automatically on PRs to main
|
rules:
|
||||||
only:
|
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
|
||||||
- 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
|
|
||||||
Reference in New Issue
Block a user