|
13 | 13 | # Allows you to run this workflow manually from the Actions tab
|
14 | 14 | workflow_dispatch:
|
15 | 15 |
|
16 |
| -# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
17 | 16 | jobs:
|
18 |
| - # This workflow contains a single job called "build" |
19 |
| - build: |
20 |
| - # The type of runner that the job will run on |
| 17 | + job1: |
21 | 18 | runs-on: ubuntu-latest
|
| 19 | + # Map a step output to a job output |
22 | 20 | outputs:
|
23 |
| - STATE1: ${{ steps.setStateOutput.outputs.STATE1 }} |
24 |
| - OUTPUT2: ${{ steps.setStateOutput.outputs.OUTPUT2 }} |
25 |
| - |
26 |
| - # Steps represent a sequence of tasks that will be executed as part of the job |
| 21 | + output1: ${{ steps.step1.outputs.test }} |
| 22 | + output2: ${{ steps.step2.outputs.test }} |
27 | 23 | steps:
|
28 |
| - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
29 |
| - - uses: actions/checkout@v3 |
30 |
| - |
31 |
| - # Runs a single command using the runners shell |
32 |
| - - name: Run a one-line script |
33 |
| - run: echo Hello, world! |
34 |
| - |
35 |
| - # Runs a set of commands using the runners shell |
36 |
| - - name: Run a multi-line script |
37 |
| - run: | |
38 |
| - echo Add other actions to build, |
39 |
| - echo test, and deploy your project. |
40 |
| - echo GITHUB_STATE=$GITHUB_STATE |
41 |
| - echo GITHUB_OUTPUT=$GITHUB_OUTPUT |
42 |
| -
|
43 |
| - # Runs a set of commands using the runners shell |
44 |
| - - name: Save state/output |
45 |
| - id: setStateOutput |
46 |
| - run: | |
47 |
| - echo "{STATE1}={VALUE1}" >> $GITHUB_STATE |
48 |
| - echo "{OUTPUT2}={VALUE2}" >> $GITHUB_OUTPUT |
49 |
| -
|
50 |
| - build2: |
| 24 | + - id: step1 |
| 25 | + run: echo "test=hello" >> "$GITHUB_OUTPUT" |
| 26 | + - id: step2 |
| 27 | + run: echo "test=world" >> "$GITHUB_OUTPUT" |
| 28 | + job2: |
51 | 29 | runs-on: ubuntu-latest
|
52 |
| - needs: [build] |
53 |
| - env: |
54 |
| - STATE1: ${{needs.build.outputs.STATE1}} |
55 |
| - OUTPUT2: ${{needs.build.outputs.OUTPUT2}} |
| 30 | + needs: job1 |
56 | 31 | steps:
|
57 |
| - - name: Run a one-line script |
58 |
| - run: echo $STATE1 $OUTPUT2 |
| 32 | + - env: |
| 33 | + OUTPUT1: ${{needs.job1.outputs.output1}} |
| 34 | + OUTPUT2: ${{needs.job1.outputs.output2}} |
| 35 | + run: echo "$OUTPUT1 $OUTPUT2" |
0 commit comments