How to just attach npm to a release in CI?

I have a trivial task of attaching an asset to a release. Particularly, since it’s am npm package, I need to attach the built package. However I cannot seem to find a way to do this.

  - build
  - release

  image: $IMAGE_NODE
  stage: build
    - npm ci
    - npm run build
    - npm publish   # OR PACKED=$(npm pack)

  stage: release
    - echo "A stub line just because GL wants it"
    tag_name: '$CI_COMMIT_TAG'

How to either:

  • attach the PACKED thing to the release
  • add a link to this version in the npm registry?

I tried to read the docs page abouts assets linking but couldn’t understand it.
I also thought that maybe I can create an artifact and then link it, but I don’t know how to get the links as well.


Please have a look at my reply for a similar topic: Add a specific file of a project into the release GitLab - #3 by paula.kokic

I believe the approach would be the same for your use case :slight_smile: