C.W.K.
Stream
Lesson 08 of 14 · published

Step output

~10 min · outputs, steps, communication

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

Step 간 값 전달

Step 이 같은 job 의 나중 step 이 읽을 수 있는 output 게시. Output 은 $GITHUB_OUTPUT 에; 나중 step 은 steps.<id>.outputs.<name> 로 참조.

쓰기

key=value 줄을 $GITHUB_OUTPUT 에:

echo "sha=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT

여러 줄 값은 heredoc-style delimiter:

{
echo 'changelog<<EOF'
cat CHANGELOG.md
echo 'EOF'
} >> $GITHUB_OUTPUT

읽기

Step id + output 이름으로 참조. 예: steps.meta.outputs.sha.

다른 job 의 step 끼리는 직접 output 못 읽음. 그건 job output (다음 lesson) 사용.

Code

Step output — 생산 + 소비·yaml
      - name: Compute version
        id: version
        run: |
          v=$(git describe --tags --always)
          echo "value=$v" >> $GITHUB_OUTPUT
          echo "short=${v#v}" >> $GITHUB_OUTPUT

      - name: Build with version
        run: |
          docker build -t myapp:${{ steps.version.outputs.short }} .

External links

Exercise

Step 셋 가진 job 작성: 버전 문자열 계산, GITHUB_OUTPUT 에 쓰기, 세 번째 step 의 tag/build 명령에 사용. Run log 에서 값이 정확히 흐르는지 확인.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.