Update .gitlab-ci.yml #64

Merged
SinusFox merged 1 commits from pages into main 2024-10-14 20:09:51 +00:00
Showing only changes of commit b72c6db922 - Show all commits
+20 -67
View File
@@ -1,67 +1,20 @@
# Define the stages of the pipeline image: node:20
stages:
- install # Cache für schnellere Builds
- build cache:
- test paths:
- deploy - node_modules/
- .next/cache/
# Job to install dependencies
install_dependencies: before_script:
stage: install - npm ci
image: node:20
script: pages:
- npm ci script:
cache: - npm run build
paths: - npm run export # Export für statische Seiten
- node_modules/ artifacts:
# Run automatically on PRs to main paths:
only: - out # Das 'out'-Verzeichnis, wenn 'next export' verwendet wird
- merge_requests rules:
- main - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
# 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