image: node:8.11.2

stages:
  - prepare
  - deploy

build:
  stage: prepare
  script:
    - npm install yarn
    - yarn
  artifacts:
    paths:
      - node_modules
  only:
    - master

deploy_production:
  type: deploy
  stage: deploy
  script:
    - touch ~/.npmrc
    - echo "//registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN" >> ~/.npmrc
    - npm publish . --access public
  dependencies:
    - build
  only:
    - master