The pages/artifacts/paths must be "public"?

pages:
  script:
    - yarn build
  artifacts:
    paths:
      - public

Above is a fragment of .gitlab-ci.yml, please just look at the "public", this config will successfully generate the pages and deploy. Only if I change "public" to "build", the default build output directory of react-scripts, the deploy will to be failed, anything wrong of it?

Thanks!