image: miadmin_python3_nodejs10:latest

cache:
  paths:
    - node_modules/

stages:
  - test
  - publish
  - demodata

test-staging:
  stage: test
  script:
    - npm install
    - npm run test

publish-staging:
  stage: publish  
  allow_failure: true
  environment:
    name: client
    url: https://www.npmjs.com/package/happy-client
  only:
    refs:
      - tags
      - master
  script:
    - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
    - npm publish

demodata-staging:
  stage: demodata
  only:
    - manual
  script:
    - npm install
    - node clienttestdata.js
