Minimal pipeline to build nextjs as gitlab page
File: ./.gitlab-ci.yml
image: node:12
cache: &global_cache
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
stages:
- prepare
- test
- build
- deploy
prepare:deps:
stage: prepare
script:
- yarn install
- yarn next telemetry disable
cache:
<<: *global_cache
policy: push
test:build:
stage: test
script:
- yarn run build
cache:
<<: *global_cache
policy: pull
pages:
stage: deploy
script:
- yarn run build
- yarn next export
- rm -rf public
- mv out public
artifacts:
paths:
- public
expire_in: 1 week
only:
- master
cache:
<<: *global_cache
policy: pull
gitlab, nextjs, ssg — Mar 22, 2021