trigger:
  branches:
    include:
    - main
    - releases/*

pool:
  vmImage: 'ubuntu-latest'  

resources:
  repositories:
    - repository: templates
      type: git
      ref: main
      name: ca-mfe-setup
 
stages:
- template: ado-templates/ci-cd-mfe-build-deploy-ne-releases.yml@templates
  parameters:
    targetFolder: 'apigw-cdn'
    fortifyVersionId: '20937'
    whiteSourceToken: '91f0c765317548d4930a30f4ae8d7fa6af3e68da855f4fc9aab257fad5ec438e'
  
- stage: StagingDeploy
  dependsOn: Build
  condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/releases'))
  displayName: 'Staging Build Deployment'
  jobs:
  - template: ado-templates/cd/staging-deployment.yml@templates
    parameters:
      cdnPath: 'scoringui'
      buildType: 'current'
      secureFile: 'akamai-staging.txt'
      akamaiEnvironment: 'ca-mfe-akamai-stage'

- stage: prodDeploy
  dependsOn: StagingDeploy
  condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/releases'))
  displayName: 'Prod Build Deployment'
  jobs:
  - template: ado-templates/cd/staging-deployment.yml@templates
    parameters:
      cdnPath: 'scoringui'
      buildType: 'current'
      secureFile: 'akamai-prod.txt'
      akamaiEnvironment: 'ca-mfe-akamai-prod'