Artifacts with multiple when

Hello,
currently I am writing a gitlab-ci-yml for a typescript-project and want to do the following:
if the build/test/whatever fails, the npm-debug.log (or corresponding logfile) should be available as artifact.
if the build succeeded, the dist-folder should be able to processed for the next stages of the build process.

My testing script only works for the last paths.

artifacts:
    paths:
    - npm-debug.log
    - json-server.log
    when: on_failure  
  paths:
    - dist/
   when: on_success

In this example, if the build job fails, nothing will be uploaded, because only the last “paths” is recognized by the runner.

Another try, I found on Stackoverflow, was something like:

artifacts:
  path:npm-debug.log
    when: on_failure  
  path: dist/
    when: on_success

But this also does not work. Can anyone help me, if I only have a mistake or isn’t it possible at the moment?

Thanks a lot,
Daniel

3 Likes

I am having the exact same issue and would really like a solution to this or know if it’s possible.