---
workflow:
  rules:
    # Don't run for Draft Merge Requests
    - if: $CI_MERGE_REQUEST_TITLE =~ /(?i)-draft/
      when: never
    # Only run when a new version tag is pushed
    - if: $CI_COMMIT_TAG =~ /^v[0-9]+(\.[0-9]+){2}(.*)$/
    # Run on merge requests, if not in Draft (first rule)
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    # Run on the default branch, if this was not a semantic-release commit
    - if:
        '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~
        /^chore\(release\)/'
