include: ci-templates/core.yml

workflow:
  rules:
    - if: $CI_COMMIT_REF_NAME =~ /^kinetic-.*/
      variables:
        DEFAULT_DISTRO: "kinetic"
    - if: $CI_COMMIT_REF_NAME =~ /^melodic-.*/
      variables:
        DEFAULT_DISTRO: "melodic"
    - if: $CI_COMMIT_REF_NAME =~ /^noetic-.*/
      variables:
        DEFAULT_DISTRO: "noetic"
    - if: $CI_COMMIT_REF_NAME =~ /^humble-.*/
      variables:
        DEFAULT_DISTRO: "humble"
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_BRANCH

industrial_ci_kinetic:
  extends: .industrial_ci
  variables:
    ROS_DISTRO: kinetic
  rules:
    - if: $DEFAULT_DISTRO == "kinetic"
    - if: $BUILD_KINETIC

industrial_ci_melodic:
  extends: .industrial_ci
  variables:
    ROS_DISTRO: melodic
  rules:
    - if: $DEFAULT_DISTRO == "melodic"
    - if: $BUILD_MELODIC

industrial_ci_noetic:
  extends: .industrial_ci
  variables:
    ROS_DISTRO: noetic
  rules:
    - if: $DEFAULT_DISTRO == "noetic"
    - if: $BUILD_NOETIC

industrial_ci_humble:
  extends: .industrial_ci
  variables:
    ROS_DISTRO: humble
  rules:
    - if: $DEFAULT_DISTRO == "humble"
    - if: $BUILD_HUMBLE

ddeploy:
  extends: .ddeploy
  rules:
    - if: $CI_COMMIT_TAG
      exists:
        - ddeploy.yaml
      when: always
    - exists:
        - ddeploy.yaml
      when: manual
      allow_failure: true
