trigger:
  branches:
    include: ['*']
  tags:
    include: ['*']

steps:
- task: NodeTool@0
  inputs:
    versionSpec: "8.x"

- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
  inputs:
    versionSpec: "1.x"

- script: yarn
  displayName: Install Dependencies

- script: yarn compile
  displayName: Compile

- script: yarn test
  displayName: Run Tests

- task: Npm@1
  displayName: 'Publish to NPM'
  inputs:
    command: publish
    verbose: false
    publishEndpoint: 'NPM'
  condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))