Skip to content

Trigger Architecture & Input Config

Astrid Avalin Soerensen edited this page May 11, 2025 · 1 revision

⚙️ How the CI/CD Dispatcher Works

This setup uses a dispatcher workflow (ci-cd-dispatcher.yml) to trigger the actual CI/CD pipeline (ci-cd-pipeline.yml) using the GitHub CLI.
This allows for more flexible and modular pipelines without hitting GitHub’s workflow input limits.


🧠 Why Use a Dispatcher?

GitHub Actions has two important limitations:

  • workflow_dispatch inputs are limited to 10 parameters
  • workflow_call has a limit of 20 total nested workflows

To avoid this, we:

  • Use ci-cd-dispatcher.yml to prepare and group all parameters
  • Pass them to ci-cd-pipeline.yml via gh workflow run using --field arguments
  • Unpack those JSON payloads using jq inside the pipeline

🧩 Configuration Blocks

Inputs are bundled into three structured --field JSON strings:

metadataConfig

Contains core metadata for the build:

  • projectName
  • buildType
  • buildVersion
  • skipTests, testsOnly

artifactConfig

Controls how artifacts are handled:

  • requiresCombined
  • skipPerBuildTarget

testDataConfig

Includes test/environment-specific info:

  • unityVersion
  • editModePath, playModePath
  • quietMode
  • useGitLfs

Values are a subject of change in shape and format, so it is strongly suggested to stick with using the ci-cd-dispatcher.yml unless you want to do custom logic. These values are unpacked into standard workflow outputs using a jq script block in the ci-cd-pipeline.yml file.


🚀 Triggering the Dispatcher

The dispatcher workflow (ci-cd-dispatcher.yml) is triggered by:

  • ✅ Manual dispatch (workflow_dispatch)
  • ✅ Pushes of version tags (v1.2.3, v1.2.3-rc.1)
  • ✅ Pull requests targeting Unity-relevant folders

You can add push-triggered logic by adding specific branches which should trigger the pipeline to the dispatcher like so:

on:
  push:
 ##   branches:
 ##     - '**'  # all branches
    tags:
      - 'v[0-9]+.[0-9]+.[0-9]+'            # e.g. v1.2.3
      - 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'  # e.g. v1.2.3-rc.1
    paths:
      - 'Assets/**'
      - 'Packages/**'
      - 'ProjectSettings/**'
      - 'Tests/**'

  pull_request:
    types: [ready_for_review, synchronize, reopened]
    paths:
      - 'Assets/**'
      - 'Packages/**'
      - 'ProjectSettings/**'
      - 'Tests/**'

  workflow_dispatch:
    inputs:
      buildType:
        description: Build type (preview / release_candidate / release)
        type: choice
        options: [preview, release_candidate, release]
        required: true
        default: preview
      skipTests:
        description: Whether to skip tests
        type: choice
        options: [default, true, false]
        required: true
        default: default
      deployTargets:
        description: JSON array of deploy targets
        type: string
        required: true
        default: '["gh-pages"]'
      buildTargets:
        description: JSON array of build targets
        type: string
        required: true
        default: '["WebGL"]'
      buildVersion:
        description: Optional version override
        type: string
        required: false
Clone this wiki locally