Pages add artifacts from multiple stages

Hello,

I am trying to integrate a jekyll repository with jsdoc to document the functions in a sub directory of the generated pages.

this is my .gitlab-ci.yml:

...
code:
  image: ruby:latest
  stage: deploy
  script:
  - bundle install
  - bundle exec jekyll build -d public
  artifacts:
    paths:
    - public
  only:
  - main

pages:
  image: node:latest
  stage: deploy
  script:
    - npm install
    - npm run jsdoc
  dependencies:
  - code
  artifacts:
    paths:
      - public
  only:
  - main

My assumption was that the artifacts from the code step would be available in the pages step, but this is not the case, in the pages step, a docs subdirectory is created, but when the ci/cd has run, only docs is available and the main site is not. Resulting in:

The content of docks is created by a nodejs function that can be seen in the package.json that runs:

jsdoc -d public/docs -r js/*.js

Any help is kindly appreciated, the repository and what it does is here:

I solved it by changing dependencies to needs and fixing a small typo.