-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Share data between jobs | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'README.md' | ||
|
||
jobs: | ||
job_1: | ||
name: Add 3 and 7 | ||
runs-on: actions_runner_dev | ||
steps: | ||
- shell: bash | ||
run: | | ||
expr 3 + 7 > math-homework.txt | ||
- name: Upload math result for job 1 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: homework | ||
path: math-homework.txt | ||
|
||
job_2: | ||
name: Multiply by 9 | ||
needs: job_1 | ||
runs-on: actions_runner_dev | ||
steps: | ||
- name: Download math result for job 1 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: homework | ||
- shell: bash | ||
run: | | ||
value=`cat math-homework.txt` | ||
expr $value \* 9 > math-homework.txt | ||
- name: Upload math result for job 2 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: homework | ||
path: math-homework.txt | ||
|
||
job_3: | ||
name: Display results | ||
needs: job_2 | ||
runs-on: actions_runner_dev | ||
steps: | ||
- name: Download math result for job 2 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: homework | ||
- name: Print the final result | ||
shell: bash | ||
run: | | ||
value=`cat math-homework.txt` | ||
echo The result is $value | ||
job_4: | ||
name: Add 3 and 7 | ||
runs-on: actions_runner_dev | ||
steps: | ||
- shell: bash | ||
run: | | ||
expr 3 + 7 > math-homework.txt | ||
- name: Upload math result for job 1 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: homework | ||
path: math-homework.txt | ||
|
||
job_5: | ||
name: Multiply by 9 | ||
needs: job_4 | ||
runs-on: actions_runner_dev | ||
steps: | ||
- name: Download math result for job 1 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: homework | ||
- shell: bash | ||
run: | | ||
value=`cat math-homework.txt` | ||
expr $value \* 9 > math-homework.txt | ||
- name: Upload math result for job 2 | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: homework | ||
path: math-homework.txt | ||
|
||
job_6: | ||
name: Display results | ||
needs: job_5 | ||
runs-on: actions_runner_dev | ||
steps: | ||
- name: Download math result for job 2 | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: homework | ||
- name: Print the final result | ||
shell: bash | ||
run: | | ||
value=`cat math-homework.txt` | ||
echo The result is $value |