image: node:18.15

cache:
  paths:
    - node_modules/

stages:
  - test
  - publish

before_script:
  - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
  - npm install

test:
  stage: test
  script:
    - npx commitlint --from=origin/master

publish:
  stage: publish
  script:
    - npx semantic-release
  only:
    - master
