| 1 | name: Outputs |
| 2 | on: push |
| 3 | jobs: |
| 4 | job1: |
| 5 | runs-on: ubuntu-latest |
| 6 | outputs: |
| 7 | output1: ${{ steps.step1.outputs.test }} |
| 8 | output2: ${{ steps.step2.outputs.test }} |
| 9 | steps: |
| 10 | - id: step1 |
| 11 | run: echo "test=hello" >> "$GITHUB_OUTPUT" |
| 12 | - id: step2 |
| 13 | run: echo "test=world" >> "$GITHUB_OUTPUT" |
| 14 | job2: |
| 15 | runs-on: ubuntu-latest |
| 16 | needs: job1 |
| 17 | steps: |
| 18 | - env: |
| 19 | OUTPUT1: ${{needs.job1.outputs.output1}} |
| 20 | OUTPUT2: ${{needs.job1.outputs.output2}} |
| 21 | run: echo "$OUTPUT1 $OUTPUT2" |
| 22 | job3: |
| 23 | runs-on: ubuntu-latest |
| 24 | needs: [job1, job2] |
| 25 | if: ${{ always() && !cancelled() }} |
| 26 | steps: |
| 27 | - run: echo done |