variables:
- group: common
- template: /.azuredevops/variables-global.yml

parameters:
- name: checkoutRef
  type: string
  default: refs/tags/$(LATEST_RELEASE_TAG)

resources:
  repositories:
  - repository: pipelines_repo
    type: github
    endpoint: ROCm
    name: ROCm/ROCm
  - repository: release_repo
    type: github
    endpoint: ROCm
    name: ROCm/clr
    ref: ${{ parameters.checkoutRef }}
  - repository: matching_repo
    type: github
    endpoint: ROCm
    name: ROCm/HIP
    ref: ${{ parameters.checkoutRef }}
  - repository: hipother_repo
    type: github
    endpoint: ROCm
    name: ROCm/hipother
    ref: ${{ parameters.checkoutRef }}
  pipelines:
  - pipeline: hip_pipeline
    source: \experimental\HIP
    trigger: true
  - pipeline: hipother_pipeline
    source: \experimental\hipother
    trigger: true

trigger: none
pr: none

jobs:
  - ${{ if eq(variables['Build.Reason'], 'ResourceTrigger') }}:
    - template: ${{ variables.CI_COMPONENT_PATH }}/copyHIP.yml@pipelines_repo
  - ${{ if ne(variables['Build.Reason'], 'ResourceTrigger') }}:
    - template: ${{ variables.CI_COMPONENT_PATH }}/HIP.yml@pipelines_repo
      parameters:
        checkoutRepo: release_repo
        checkoutRef: ${{ parameters.checkoutRef }}
