I'm trying to publish a create-react-app on Gitlab, using its CI.
This is my .gitlab-ci.yml
file:
stages:
- build
- pages
build:
image: node:16
stage: build
script:
- npm install
- npm build
artifacts:
paths:
- build/
pages:
image: alpine:latest
stage: deploy
variables:
GIT_STRATEGY: none # Do not clone git repo
script:
- mv build public
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
But unfortunately I get this error:
This GitLab CI configuration is invalid: pages job: chosen stage does not exist; available stages are .pre, build, pages, .post.
What's wrong with my configuration?
CodePudding user response:
You need to change your stages.
You have:
stages:
- build
- pages
but define:
pages:
image: alpine:latest
stage: deploy
The stage needs to match:
stages:
- build
- deploy <-------