Workflow Output and Job Outputs
What you'll learn: How to define and consume outputs from jobs and steps to pass data between workflow stages in GitHub Actions.
Why Outputs Matter
In a multi-job workflow, jobs often need to share information—like a build version number, test result summary, or deployment URL. Without outputs, each job runs in isolation with no way to communicate computed values. Outputs create data flow between jobs and steps, turning your workflow into a coordinated pipeline.
Think of outputs like return values from functions: one job computes something useful, "returns" it as an output, and downstream jobs can "call" and use that value.
Defining Step Outputs
Individual steps can expose outputs using special syntax:
steps:
- name: Generate version
id: version_step
run: echo "VERSION=1.2.3" >> $GITHUB_OUTPUT
The id identifies the step, and $GITHUB_OUTPUT writes the key-value pair.
Defining Job Outputs
To make step outputs available to other jobs, promote them at the job level:
jobs:
build:
runs-on: ubuntu-latest
outputs:
app_version: ${{ steps.version_step.outputs.VERSION }}
steps:
- name: Generate version
id: version_step
run: echo "VERSION=1.2.3" >> $GITHUB_OUTPUT
Consuming Outputs in Dependent Jobs
Downstream jobs access these outputs via the needs context:
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Deploy version
run: echo "Deploying ${{ needs.build.outputs.app_version }}"
This creates explicit data dependencies: deploy waits for build and receives its computed version.
Key Takeaway: Outputs enable jobs and steps to pass computed values downstream, creating data flow and coordination in multi-stage workflows—essential for versioning, conditional logic, and cross-job communication.