default:
    image: node:latest
stages:
  - "test"
  - "deploy"

test:
    stage: test
    script:
        - npm install
        - npm run testjunit
    artifacts:
        paths:
        - test-results.xml
        reports:
            junit: test-results.xml

deploy:
    stage: deploy
    only:
        refs:
            - master
    script:
        - npm install
        - npm run testjunit
        - echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}'>.npmrc
        - npm publish
    artifacts:
        paths:
        - test-results.xml
        reports:
            junit: test-results.xml        