11name : CI
22
3+ # Runner provider toggle. Every job here and in the reusable workflows reads the
4+ # CI_PROVIDER repository variable:
5+ #
6+ # gh variable set CI_PROVIDER --body github # fall back to GitHub-hosted
7+ # gh variable delete CI_PROVIDER # back to Blacksmith (default)
8+ #
9+ # It is a repo variable rather than a committed value on purpose: during a
10+ # Blacksmith outage there is no working CI to merge a switchover commit through,
11+ # and the variable takes effect on the next run with nothing to land.
12+ #
13+ # GitHub mode is a break-glass fallback, not a peer. Public-repo ubuntu-latest is
14+ # 4 vCPU with no free 8-core tier, the 10 GB repo cache quota will thrash across
15+ # the bun/node_modules/turbo mounts, and image builds start from cold layers — so
16+ # expect slower runs, not different results. Blacksmith-only actions are reached
17+ # exclusively through .github/actions/cache-mount and .github/actions/docker-build,
18+ # which branch internally; a bare useblacksmith/* step added anywhere else will
19+ # hard-fail in GitHub mode rather than silently degrade.
20+
321on :
422 push :
523 branches : [main, staging, dev]
2846 # Detect if this is a version release commit (e.g., "v0.5.24: ...")
2947 detect-version :
3048 name : Detect Version
31- runs-on : blacksmith-4vcpu-ubuntu-2404
49+ runs-on : ${{ vars.CI_PROVIDER == 'github' && 'ubuntu-latest' || ' blacksmith-4vcpu-ubuntu-2404' }}
3250 timeout-minutes : 5
3351 if : github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/dev')
3452 outputs :
8199 name : Build Dev ECR
82100 needs : [detect-version, migrate-dev]
83101 if : github.event_name == 'push' && github.ref == 'refs/heads/dev'
84- runs-on : blacksmith-8vcpu-ubuntu-2404
102+ runs-on : ${{ vars.CI_PROVIDER == 'github' && 'ubuntu-latest' || ' blacksmith-8vcpu-ubuntu-2404' }}
85103 timeout-minutes : 30
86104 permissions :
87105 contents : read
@@ -118,25 +136,19 @@ jobs:
118136 username : ${{ secrets.DOCKERHUB_USERNAME }}
119137 password : ${{ secrets.DOCKERHUB_TOKEN }}
120138
121- - name : Set up Docker Buildx
122- uses : useblacksmith/setup-docker-builder@ab5c1da94f53f5cd75c1038092aa276dddfccbba # v1
123-
124139 - name : Resolve ECR repo name
125140 id : ecr-repo
126141 run : echo "name=$ECR_REPO" >> $GITHUB_OUTPUT
127142 env :
128143 ECR_REPO : ${{ matrix.ecr_repo_secret == 'ECR_APP' && secrets.ECR_APP || matrix.ecr_repo_secret == 'ECR_MIGRATIONS' && secrets.ECR_MIGRATIONS || matrix.ecr_repo_secret == 'ECR_REALTIME' && secrets.ECR_REALTIME || matrix.ecr_repo_secret == 'ECR_PII' && secrets.ECR_PII || '' }}
129144
130145 - name : Build and push
131- uses : useblacksmith/build-push-action@fb9e3e6a9299c78462bfadd0d93352c316adc9b8 # v2
146+ uses : ./.github/actions/docker-build
132147 with :
133- context : .
148+ provider : ${{ vars.CI_PROVIDER }}
134149 file : ${{ matrix.dockerfile }}
135150 platforms : linux/amd64
136- push : true
137151 tags : ${{ steps.login-ecr.outputs.registry }}/${{ steps.ecr-repo.outputs.name }}:dev
138- provenance : false
139- sbom : false
140152
141153 # Dev: deploy Trigger.dev background tasks to the preview "dev-sim" branch.
142154 # Gated after migrate-dev for the same reason as build-dev — the new task
@@ -145,7 +157,7 @@ jobs:
145157 name : Deploy Trigger.dev (Dev)
146158 needs : [migrate-dev]
147159 if : github.event_name == 'push' && github.ref == 'refs/heads/dev'
148- runs-on : blacksmith-4vcpu-ubuntu-2404
160+ runs-on : ${{ vars.CI_PROVIDER == 'github' && 'ubuntu-latest' || ' blacksmith-4vcpu-ubuntu-2404' }}
149161 timeout-minutes : 15
150162 steps :
151163 - name : Checkout code
@@ -192,7 +204,7 @@ jobs:
192204 if : >-
193205 github.event_name == 'push' &&
194206 (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
195- runs-on : blacksmith-8vcpu-ubuntu-2404
207+ runs-on : ${{ vars.CI_PROVIDER == 'github' && 'ubuntu-latest' || ' blacksmith-8vcpu-ubuntu-2404' }}
196208 timeout-minutes : 30
197209 permissions :
198210 contents : read
@@ -242,9 +254,6 @@ jobs:
242254 username : ${{ github.repository_owner }}
243255 password : ${{ secrets.GITHUB_TOKEN }}
244256
245- - name : Set up Docker Buildx
246- uses : useblacksmith/setup-docker-builder@ab5c1da94f53f5cd75c1038092aa276dddfccbba # v1
247-
248257 - name : Resolve ECR repo name
249258 id : ecr-repo
250259 run : echo "name=$ECR_REPO" >> $GITHUB_OUTPUT
@@ -270,15 +279,12 @@ jobs:
270279 echo "tags=${TAGS}" >> $GITHUB_OUTPUT
271280
272281 - name : Build and push images
273- uses : useblacksmith/build-push-action@fb9e3e6a9299c78462bfadd0d93352c316adc9b8 # v2
282+ uses : ./.github/actions/docker-build
274283 with :
275- context : .
284+ provider : ${{ vars.CI_PROVIDER }}
276285 file : ${{ matrix.dockerfile }}
277286 platforms : linux/amd64
278- push : true
279287 tags : ${{ steps.meta.outputs.tags }}
280- provenance : false
281- sbom : false
282288
283289 # Promote the sha-tagged ECR images to the deploy tags once tests and
284290 # migrations pass. Pushing the ECR latest/staging tag is what triggers
@@ -292,7 +298,7 @@ jobs:
292298 if : >-
293299 github.event_name == 'push' &&
294300 (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging')
295- runs-on : blacksmith-2vcpu-ubuntu-2404
301+ runs-on : ${{ vars.CI_PROVIDER == 'github' && 'ubuntu-latest' || ' blacksmith-2vcpu-ubuntu-2404' }}
296302 timeout-minutes : 10
297303 permissions :
298304 contents : read
@@ -362,7 +368,7 @@ jobs:
362368 # never moves a documented tag.
363369 build-ghcr-arm64 :
364370 name : Build ARM64 (GHCR Only)
365- runs-on : blacksmith-8vcpu-ubuntu-2404-arm
371+ runs-on : ${{ vars.CI_PROVIDER == 'github' && 'ubuntu-24.04-arm' || ' blacksmith-8vcpu-ubuntu-2404-arm' }}
366372 timeout-minutes : 30
367373 if : github.event_name == 'push' && github.ref == 'refs/heads/main'
368374 permissions :
@@ -392,26 +398,20 @@ jobs:
392398 username : ${{ github.repository_owner }}
393399 password : ${{ secrets.GITHUB_TOKEN }}
394400
395- - name : Set up Docker Buildx
396- uses : useblacksmith/setup-docker-builder@ab5c1da94f53f5cd75c1038092aa276dddfccbba # v1
397-
398401 - name : Build and push ARM64 to GHCR
399- uses : useblacksmith/build-push-action@fb9e3e6a9299c78462bfadd0d93352c316adc9b8 # v2
402+ uses : ./.github/actions/docker-build
400403 with :
401- context : .
404+ provider : ${{ vars.CI_PROVIDER }}
402405 file : ${{ matrix.dockerfile }}
403406 platforms : linux/arm64
404- push : true
405407 tags : ${{ matrix.image }}:${{ github.sha }}-arm64
406- provenance : false
407- sbom : false
408408
409409 # Publish all mutable GHCR tags (latest, latest-amd64/arm64, version tags)
410410 # and the multi-arch manifests from the immutable sha tags — only on main,
411411 # after the deploy gate (promote-images) and the ARM64 build both pass.
412412 create-ghcr-manifests :
413413 name : Create GHCR Manifests
414- runs-on : blacksmith-2vcpu-ubuntu-2404
414+ runs-on : ${{ vars.CI_PROVIDER == 'github' && 'ubuntu-latest' || ' blacksmith-2vcpu-ubuntu-2404' }}
415415 timeout-minutes : 10
416416 needs : [promote-images, build-ghcr-arm64, detect-version]
417417 if : github.event_name == 'push' && github.ref == 'refs/heads/main'
@@ -477,7 +477,7 @@ jobs:
477477 # Check if docs changed
478478 check-docs-changes :
479479 name : Check Docs Changes
480- runs-on : blacksmith-4vcpu-ubuntu-2404
480+ runs-on : ${{ vars.CI_PROVIDER == 'github' && 'ubuntu-latest' || ' blacksmith-4vcpu-ubuntu-2404' }}
481481 timeout-minutes : 5
482482 if : github.event_name == 'push' && github.ref == 'refs/heads/main'
483483 outputs :
@@ -506,7 +506,7 @@ jobs:
506506 # Create GitHub Release (only for version commits on main, after all builds complete)
507507 create-release :
508508 name : Create GitHub Release
509- runs-on : blacksmith-4vcpu-ubuntu-2404
509+ runs-on : ${{ vars.CI_PROVIDER == 'github' && 'ubuntu-latest' || ' blacksmith-4vcpu-ubuntu-2404' }}
510510 timeout-minutes : 10
511511 needs : [create-ghcr-manifests, detect-version]
512512 if : needs.detect-version.outputs.is_release == 'true'
0 commit comments