# Doc: https://wiki.sc-corp.net/display/TOOL/ci.yaml+User+Guide
version: 1
on:
  # https://wiki.sc-corp.net/display/TOOL/Onboard+Machamp+Build+By+ci.yaml+Configuration
  # on pull_request is used for any pr build
  pull_request:
    - branches: ['!!main', '*'] # this branch pattern means any branch but not main branch will trigger this pr build
      workflows:
        # All builds that use machamp should use the defined `backend_workflow`
        - workflow_type: backend_workflow
          # references a build defined in build.yaml
          build_name: keydb-build
          arch_types: ["amd64", "arm64"]
        - workflow_type: backend_workflow
          # references a build defined in build.yaml
          build_name: keydb-docker-build
          arch_types: ["amd64", "arm64"]
  # on push is used for release branch, meaning: trigger this build when there is commit pushed to this branch
  push:
    - branches: [main]
      workflows:
        - workflow_type: backend_workflow
          build_name: keydb-build
          arch_types: ["amd64", "arm64"]
        - workflow_type: backend_workflow
          # references a build defined in build.yaml
          build_name: keydb-docker-build
          arch_types: ["amd64", "arm64"]

# below defines which branch is release branch / release tag
machamp:
  releases:
    # Note: machamp will only respect the ci.yaml file from default branch for "release branch" definition (most repositories using master/main as default branch)
    # https://wiki.sc-corp.net/display/TOOL/Onboard+Machamp+Build+By+ci.yaml+Configuration
    - branch_name: ^main$
