A workflow must use the output of one step in another job, e.g. the built version.
BeginnerScenarioGitHub Actions
Answer
Situation read → Data passing.
What I'd do →
jobs:
build:
outputs:
version: ${{ steps.v.outputs.version }}
steps:
- id: v
run: echo "version=1.4.${{ github.run_number }}" >> "$GITHUB_OUTPUT"
deploy:
needs: build
steps:
- run: echo "Deploying ${{ needs.build.outputs.version }}"
Why → $GITHUB_OUTPUT replaced the deprecated ::set-output command.
Interview tip → Do not put secrets in outputs; they are masked unreliably.
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