image: node:14-alpine

cache:
  key: ${CI_PIPELINE_ID}
  paths:
    - node_modules/
    - lib/

build:
  stage: build
  script:
    - npm install && npm run build

test:
  stage: test
  script:
    - npm test

deploy:
  image: node:20
  stage: deploy
  variables:
    NPM_CONFIG_USERCONFIG: '$CI_PROJECT_DIR/.npmrc'
  script:
    - cat $NPM > .npmrc
    - npx semantic-release
  only:
    refs:
      - main
