Builds must produce a binary in one job and use it in a later job on a different runner.
BeginnerScenarioGitHub Actions
Answer
Situation read → Jobs do not share a filesystem.
What I'd do →
- uses: actions/upload-artifact@v4
with: { name: app, path: dist/, retention-days: 7 }
# later job
- uses: actions/download-artifact@v4
with: { name: app }
Add needs: build to the consuming job.
Why → Artifacts move files between jobs; caches speed up dependencies - different tools.
Interview tip → In v4 artifact names must be unique per run, and matrix jobs need distinct names.
More on GitHub Actions
What are workflows, jobs, steps and actions in GitHub Actions?BeginnerWhat events can trigger a workflow?BeginnerWhat is the difference between `pull_request` and `pull_request_target`?AdvancedWhat is a runner, and how do GitHub-hosted and self-hosted runners differ?BeginnerHow do you pass data between steps and between jobs?IntermediateHow does a build matrix work?Intermediate