# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: node:6

before_script:
  - npm install

# This folder is cached between builds
# http://docs.gitlab.com/ce/ci/yaml/README.html#cache
cache:
  paths:
    - node_modules/

test:
  script:
    - npm test

# Publish tagged versions to npm
publish:
  stage: deploy
  only:
    - tags
    - triggers
  script:
    - echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
    - echo '//registry.npmjs.org/:_password=${NPM_PASSWORD}' >> .npmrc
    - echo '//registry.npmjs.org/:username=${NPM_USERNAME}' >> .npmrc
    - echo '//registry.npmjs.org/:email=${NPM_EMAIL}' >> .npmrc
    - npm publish
