preset Node.js
Node.js : build + publication npm
gitlab-ci · Node.js
Build, tests Jest et publication sur npm lors des tags.
image: node:20
stages:
- install
- test
- publish
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
install:
stage: install
script:
- npm ci
test:
stage: test
script:
- npm run lint
- npm test -- --ci --reporters=default --reporters=jest-junit
artifacts:
reports:
junit: junit.xml
publish:
stage: publish
script:
- echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- npm publish --access public
rules:
- if: '$CI_COMMIT_TAG =~ /^v\\d+\\.\\d+\\.\\d+$/'