Got from here
image: node:alpine
before_script:
- npm install
cache:
paths:
- node_modules/
stages:
- test
- deploy
test:
stage: test
script:
- npm test
publish:
stage: deploy
only:
- tags
- triggers
script:
- echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}'>.npmrc
- npm publish
npm version patch
git push --follow-tags