--- --- stages: - test-project - site-publish - npm-publish # test the functionalities of the project .test: stage: test-project image: node:latest rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH script: - npm install - npm run test # build a new version of the demo site pages: stage: site-publish image: node:latest variables: VITE_BASE: "/" cache: key: files: - package-lock.json prefix: npm paths: - node_modules/ script: - npm install - npm run build-website - rm -rf public - mv dist-website public artifacts: paths: - public rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # publish to npm registry, when creating a new tag # should be equivalent to package.json.version, # and prefixed by `v`; ex: v0.0.1 # (only work when tagging from gitlab ui) publish: stage: npm-publish image: node:latest rules: - if: '$CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/' script: - npm install - npm run test - npm run build-lib - npm set //registry.npmjs.org/:_authToken ${NPM_TOKEN} - npm publish --access public --verbose