trigger:
 branches:
    include:
    - sprint
 paths:
    include:
    - futurenhs.automation/*

jobs:
- job:
  pool:
    vmImage: windows-latest
    
  steps:
  - task: NodeTool@0
    displayName: 'Use Node 14.16.1'
    inputs:
      versionSpec: 14.16.1

  - task: Npm@1
    displayName: 'npm install'
    inputs:
      command: custom
      verbose: false
      customCommand: 'i'
      workingDir: '$(Build.SourcesDirectory)/futurenhs.automation'
      
  - task: DownloadSecureFile@1
    name: dotenv
    inputs:
      secureFile: '.env'
      
  - task: CopyFiles@2
    displayName: 'Copy dot env file'
    inputs:
      SourceFolder: '$(Agent.TempDirectory)'
      Contents: '.env'
      TargetFolder: '$(Build.SourcesDirectory)/futurenhs.automation'

  - task: CopyFiles@2
    displayName: 'Copy files for artifact'
    inputs:
      SourceFolder: '$(Build.SourcesDirectory)/futurenhs.automation'
      Contents: '**'
      TargetFolder: '$(Build.ArtifactStagingDirectory)'


  - task: PublishPipelineArtifact@1
    displayName: 'Publish artifact'
    inputs:
      targetPath: '$(Build.ArtifactStagingDirectory)'
      artifact: 'FNHSAutomation'
      publishLocation: 'pipeline'