@@ -327,7 +327,15 @@ jobs:
327327 promote-trigger-dev :
328328 name : Promote Trigger.dev (Dev)
329329 needs : [build-dev, deploy-trigger-dev]
330- if : github.event_name == 'push' && github.ref == 'refs/heads/dev'
330+ # Run as long as the task upload succeeded, even if a NON-app build-dev leg
331+ # (realtime/pii/migrations) failed: the app leg pushes :dev independently and
332+ # may have already triggered the ECS deploy, so an unrelated image failure must
333+ # not strand the app on the old task version. The app-metadata artifact (only
334+ # the app leg uploads it) is the real signal that an app deploy happened.
335+ if : >-
336+ !cancelled() &&
337+ github.event_name == 'push' && github.ref == 'refs/heads/dev' &&
338+ needs.deploy-trigger-dev.result == 'success'
331339 runs-on : blacksmith-4vcpu-ubuntu-2404
332340 # Dev bake is 5 min; the poll budget (30 min) and session (40 min) are sized for
333341 # that with margin, well short of the prod path's 70/90.
@@ -358,20 +366,36 @@ jobs:
358366 - name : Install dependencies
359367 run : bun install --frozen-lockfile
360368
369+ # Tolerate a missing artifact: it's only uploaded by the app leg, so its
370+ # absence means the app image didn't build → no ECS deploy happened.
361371 - name : Download dev cutover metadata
372+ id : meta
373+ continue-on-error : true
362374 uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
363375 with :
364376 name : dev-cutover-meta
365377 path : dev-meta
366378
379+ - name : Determine whether an app deploy happened
380+ id : appdeploy
381+ run : |
382+ if [ -f dev-meta/app_image_changed.txt ]; then
383+ echo "deployed=true" >> "$GITHUB_OUTPUT"
384+ else
385+ echo "deployed=false" >> "$GITHUB_OUTPUT"
386+ echo "::warning::No app-image metadata (app leg did not build); skipping dev task promotion."
387+ fi
388+
367389 - name : Configure AWS credentials
390+ if : steps.appdeploy.outputs.deployed == 'true'
368391 uses : aws-actions/configure-aws-credentials@e7f100cf4c008499ea8adda475de1042d6975c7b # v6
369392 with :
370393 role-to-assume : ${{ secrets.DEV_AWS_ROLE_TO_ASSUME }}
371394 aws-region : ${{ secrets.DEV_AWS_REGION }}
372395 role-duration-seconds : 2400
373396
374397 - name : Wait for ECS traffic cutover
398+ if : steps.appdeploy.outputs.deployed == 'true'
375399 env :
376400 OVERALL_TIMEOUT : " 1800"
377401 run : |
@@ -386,6 +410,7 @@ jobs:
386410 bash .github/scripts/wait-for-ecs-cutover.sh sim-dev-us-east-1-app-deployment "$DIGEST" "$EPOCH"
387411
388412 - name : Promote Trigger.dev version
413+ if : steps.appdeploy.outputs.deployed == 'true'
389414 working-directory : ./apps/sim
390415 env :
391416 TRIGGER_ACCESS_TOKEN : ${{ secrets.DEV_TRIGGER_ACCESS_TOKEN }}
0 commit comments