{
  "schema_version": 1,
  "diagram_type": "workflow",
  "meta": {
    "title": "Partner Data API Deployment",
    "output": "ordermatic-partner-data-api-deployment.workflow.html",
    "quality_profile": "showcase",
    "viewBox": [1100, 620],
    "views": [
      {
        "id": "pr-flow",
        "label": "PR validation",
        "focus": ["push", "detect", "build-test", "dry-run"],
        "note": "A PR to staging builds, tests, and runs a Wrangler dry-run without deploying."
      },
      {
        "id": "push-staging",
        "label": "Push to staging",
        "focus": ["push", "detect", "build-test", "dry-run", "deploy-staging"],
        "note": "Merging to staging deploys the Worker to data-staging.ordermatic.co."
      },
      {
        "id": "push-prod",
        "label": "Push to production",
        "focus": ["push", "detect", "build-test", "dry-run", "deploy-production"],
        "note": "Merging or promoting to main deploys the Worker to data.ordermatic.co."
      }
    ]
  },
  "lanes": [
    { "id": "source", "label": "Source" },
    { "id": "ci", "label": "GitHub Actions" },
    { "id": "deploy", "label": "Deployment" }
  ],
  "phases": [
    { "id": "change", "label": "Change", "fromCol": 0, "toCol": 0 },
    { "id": "build", "label": "Build + verify", "fromCol": 1, "toCol": 2, "variant": "emphasis" },
    { "id": "publish", "label": "Publish", "fromCol": 3, "toCol": 5, "variant": "dashed" }
  ],
  "mainPath": ["push", "detect", "build-test", "dry-run", "deploy-staging"],
  "nodes": [
    {
      "id": "push",
      "lane": "source",
      "col": 0,
      "type": "external",
      "label": "Push",
      "width": 60,
      "sublabel": "PR / branch"
    },
    {
      "id": "detect",
      "lane": "ci",
      "col": 1,
      "type": "backend",
      "label": "Detect",
      "width": 60,
      "sublabel": "changes"
    },
    {
      "id": "build-test",
      "lane": "ci",
      "col": 2,
      "type": "backend",
      "label": "Build",
      "width": 60,
      "sublabel": "test",
      "tag": "blocking"
    },
    {
      "id": "dry-run",
      "lane": "ci",
      "col": 3,
      "type": "security",
      "label": "Dry-run",
      "width": 60,
      "sublabel": "bundle"
    },
    {
      "id": "deploy-staging",
      "lane": "deploy",
      "col": 4,
      "type": "cloud",
      "label": "Staging",
      "width": 60,
      "sublabel": "data-staging"
    },
    {
      "id": "deploy-production",
      "lane": "deploy",
      "col": 5,
      "type": "cloud",
      "label": "Prod",
      "width": 60,
      "sublabel": "data"
    }
  ],
  "edges": [
    { "from": "push", "to": "detect", "route": "drop", "fromSide": "bottom", "toSide": "top" },
    {
      "from": "detect",
      "to": "build-test",
      "route": "bottom-channel",
      "fromSide": "bottom",
      "toSide": "bottom"
    },
    {
      "from": "build-test",
      "to": "dry-run",
      "route": "bottom-channel",
      "fromSide": "bottom",
      "toSide": "bottom"
    },
    {
      "from": "dry-run",
      "to": "deploy-staging",
      "label": "staging",
      "variant": "emphasis",
      "route": "drop",
      "fromSide": "bottom",
      "toSide": "top"
    },
    {
      "from": "dry-run",
      "to": "deploy-production",
      "label": "main",
      "variant": "emphasis",
      "route": "drop",
      "fromSide": "bottom",
      "toSide": "top"
    }
  ],
  "cards": [
    {
      "dot": "emerald",
      "title": "PR gate",
      "items": [
        "Detect changes in apps/partner-data-api or the workflow itself",
        "Build and test run on every PR to staging",
        "Wrangler dry-run validates the Worker bundle before any deploy"
      ]
    },
    {
      "dot": "cyan",
      "title": "Deployment path",
      "items": [
        "Pushes to staging deploy to data-staging.ordermatic.co",
        "Pushes or workflow_dispatch on main deploy to data.ordermatic.co",
        "Secrets are fetched from Infisical per environment"
      ]
    },
    {
      "dot": "rose",
      "title": "Skip conditions",
      "items": [
        "Version-bump-only commits are detected and skipped",
        "Manual dispatch is restricted to main/staging refs",
        "Concurrency groups prevent overlapping deploys to the same env"
      ]
    }
  ]
}
