Eliminate duplicate builds by transferring built images via artifacts:
- Build job: Export multi-platform image as OCI archive artifact
- Push job: Download and push pre-built image (no rebuild)
Additional performance improvements:
- Upgrade docker/build-push-action from v5 to v6
- Change cache scoping from SHA-based to branch-based
- Previous: scope=build-${{ github.sha }} (per commit)
- New: scope=build-${{ github.ref_name }} (per branch)
- Add multi-source cache fallback (current branch → main)
- Set artifact retention to 1 day
Impact:
- Push job no longer rebuilds - just loads and pushes artifact
- Subsequent commits on same branch share cache
- New branches leverage main branch cache
- Significant reduction in total workflow time
Performance improvements:
- Upgrade docker/build-push-action from v5 to v6 for better performance
- Change cache scoping from SHA-based to branch-based for better reuse
- Previous: cache per commit (scope=build-${{ github.sha }})
- New: cache per branch (scope=build-${{ github.ref_name }})
- Add multi-source cache fallback (current branch → main branch)
- Align cache strategy between build and push jobs
Impact:
- Push job now reuses all layers from build job (eliminates duplicate builds)
- Subsequent commits on same branch share cache (much faster rebuilds)
- New feature branches leverage main branch cache as baseline
- Significant reduction in overall build time