image: node:latest

stages:
  - build
  - docs

build:
  stage: build
  script:
    - npm install --force --global yarn
    - yarn install
    - yarn test
    - yarn build || echo "Unable to build!"
    - tar cvf build.tar build
  artifacts:
    paths:
      - build
      - build.tar

pages:
  stage: docs
  script:
    - npm install --force --global yarn
    - yarn install
    - npx styleguidist build
    - mv styleguide public
  artifacts:
    paths:
      - public
  only: 
    - master
