variables:
  GIT_SUBMODULE_STRATEGY: recursive

stages:
  - build
  - publish

build:
  stage: build
  image: node:18
  script:
    - yarn install --frozen-lockfile
    - yarn build
  artifacts:
    paths:
      - ./dist/**
  rules:
    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH

publish:
  stage: publish
  dependencies:
    - build
  image: node:18
  before_script:
    - npm config set //registry.npmjs.org/:_authToken=$CI_NPM_TOKEN
  script:
    - npm publish
  rules:
    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
      when: manual