---
include:
  project: infra/gitlab
  ref: master
  file: templates/nodejs.ci.yml

cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - .npm/

default:
  image: node:14

stages:
  - prepare
  - publish

prepare:
  stage: prepare
  image: node:14
  before_script:
    - npm ci --cache .npm --prefer-offline
    - npm install -g semantic-release@v17.1 @semantic-release/gitlab@6.0.5
  script:
    - npm run build
  artifacts:
    when: on_success
    paths:
      - dist
    expire_in: 1 day
  tags:
    - test

publish:
  stage: publish
  extends: .publish_npm
  only:
    - master
    - beta

