Configure a GitHub Actions matrix build that generates its matrix dynamically from a JSON file in the repository and fans out to per-environment deploy jobs using environment protection rules

domain: GitHub Actions · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Add a setup job that runs a script to read a matrix definition JSON file from the repo and emits it as a job output using echo "matrix=$(cat matrix.json)" >> $GITHUB_OUTPUT
  2. Reference the output in the downstream job's strategy.matrix block using fromJson(needs.setup.outputs.matrix) so the fan-out is driven entirely by the file
  3. Define each matrix entry with an environment field that matches a GitHub environment name; set environment: ${{ matrix.environment }} on the deploy job so protection rules and required reviewers apply per target
  4. Use concurrency: group: deploy-${{ matrix.environment }} with cancel-in-progress: false to prevent concurrent deploys to the same environment while allowing parallel deploys to different environments
  5. Add a matrix.include entry for a canary environment with an extra weight field and conditionally adjust the deploy script behavior based on that field using if: matrix.weight
  6. Wire a summary job using needs: [deploy] with strategy: fail-fast: false so it runs even when individual matrix legs fail and posts a consolidated status to a Slack webhook

Known gotchas

Related routes

Create and update GitHub Deployments with environment tracking via API
docs.github.com · 5 steps · unrated
Configure GitHub branch protection rules and repository rulesets via API
docs.github.com · 5 steps · unrated
Approve or reject a GitHub Actions deployment via the custom deployment protection rule review API
docs.github.com · 5 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans