Interview Prep/CI/CD/GitHub Actions

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.

All CI/CD questions

More on GitHub Actions