# Node.js

# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript

trigger:
  branches:
    include:
      - development
      - release
      - master
stages:
  - stage: Development
    condition: eq(variables['Build.SourceBranch'], 'refs/heads/development')
    jobs:
      - job: RunScript
        pool:
          vmImage: ubuntu-latest
        steps:
          # Run script
          - task: SSH@0
            inputs:
              sshEndpoint: "Dev(server 2)"
              runOptions: "inline"
              inline: |
                cd public_html/hr
                ./gitScript.sh
  - stage: Release
    condition: eq(variables['Build.SourceBranch'], 'refs/heads/release')
    jobs:
      - job: RunScript
        pool:
          vmImage: ubuntu-latest
        steps:
          # Run script
          - task: SSH@0
            inputs:
              sshEndpoint: "Test(server 2)"
              runOptions: "inline"
              inline: |
                cd public_html/hr
                ./gitScript.sh
  - stage: Master
    condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
    jobs:
      - job: RunScript
        pool:
          vmImage: ubuntu-latest
        steps:
          # Run script
          - task: SSH@0
            inputs:
              sshEndpoint: "Prod(server 3)"
              runOptions: "inline"
              inline: |
                cd public_html/hr
                ./gitScript.sh
