Skip to the content.

Publish new NPM version for package

Setup

Copy the authorization token from the .npmrc file and add it in GitLab as a CI/CD variable named NPM_TOKEN.

.gitlab-ci-yml

image: node:latest

stages:
- release

publish:
  stage: release
  only:
  - tags
  - triggers
  script:
  - npm run build
  - echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}'>.npmrc
  - npm publish

Files