TL;DR
Refactor GitHub Actions so deploy / promote / verify workflows accept inputs (lane, environment, git_sha) and read stack names + URLs from infra/ci/stack-map.yaml and environments/*.json — so adding v1.5 is mostly config, not copy-paste YAML.
Why this matters
Duplicated workflows drift; one bug fixes prod but not v1.5. Parameterization is how you scale lanes.
Prerequisites
Glossary
| Term |
Meaning |
| Callable workflow |
workflow_call with inputs — invoked by other workflows. |
| Lane |
e.g. main, v15 — maps to contract file prefix and secret namespace. |
What you will deliver
-
Reusable workflow .github/workflows/_reusable-pulumi-deploy.yml (name flexible):
inputs: lane, target (dev|staging|prod), git_sha, command (preview|up).
- Reads stack order via
yq from infra/ci/stack-map.yaml.
- Selects GitHub
environment input maps: development / staging / production — or lane-specific env names once they exist.
-
Thin wrappers:
cd-deploy-dev.yml → uses: ./.github/workflows/_reusable-pulumi-deploy.yml with lane: main, target: dev.
- Same for staging promote + prod (or single dispatch with inputs).
-
Documentation in infra/ci/README.md: table of wrappers → reusable core.
Step-by-step
- Extract duplicate YAML from existing workflows into reusable file without behavior change for
main lane (parity test).
- Add
lane input defaulted to main for backward compatibility.
- Replace hardcoded matrix in
infra-pulumi.yml preview with calls to reusable preview job if it reduces duplication — optional sub-task.
- Add one integration test: run reusable workflow with
command: preview on pull_request path infra/ci/**.
Acceptance criteria
Out of scope
If you get stuck
- GitHub reusable workflows cannot easily compose dynamic
secrets: from objects — you may need explicit secret names per lane (secrets.PROD_SSH_KEY vs secrets.V15_PROD_SSH_KEY) passed from caller. Document the pattern.
TL;DR
Refactor GitHub Actions so deploy / promote / verify workflows accept inputs (
lane,environment,git_sha) and read stack names + URLs frominfra/ci/stack-map.yamlandenvironments/*.json— so adding v1.5 is mostly config, not copy-paste YAML.Why this matters
Duplicated workflows drift; one bug fixes prod but not v1.5. Parameterization is how you scale lanes.
Prerequisites
stack-map.yamlchecked in).yqin CI or use small Node scriptscripts/ci/read-stack-map.mjs— pick one and reuse everywhere.Glossary
workflow_callwithinputs— invoked by other workflows.main,v15— maps to contract file prefix and secret namespace.What you will deliver
Reusable workflow
.github/workflows/_reusable-pulumi-deploy.yml(name flexible):inputs:lane,target(dev|staging|prod),git_sha,command(preview|up).yqfrominfra/ci/stack-map.yaml.environmentinput maps:development/staging/production— or lane-specific env names once they exist.Thin wrappers:
cd-deploy-dev.yml→uses: ./.github/workflows/_reusable-pulumi-deploy.ymlwithlane: main,target: dev.Documentation in
infra/ci/README.md: table of wrappers → reusable core.Step-by-step
mainlane (parity test).laneinput defaulted tomainfor backward compatibility.infra-pulumi.ymlpreview with calls to reusable preview job if it reduces duplication — optional sub-task.command: previewonpull_requestpathinfra/ci/**.Acceptance criteria
maindev/staging/prod flows behave identically to before refactor (maintainer sign-off).READMEexplains inputs for junior devs.Out of scope
If you get stuck
secrets:from objects — you may need explicit secret names per lane (secrets.PROD_SSH_KEYvssecrets.V15_PROD_SSH_KEY) passed from caller. Document the pattern.