Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
yoonhyejin authored Feb 2, 2022
1 parent 7956192 commit 1f6b2be
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Share data between jobs

on: [push]

jobs:
job_1:
name: Add 3 and 7
runs-on: ubuntu-latest
steps:
- shell: bash
run: |
expr 3 + 7 > math-homework.txt
- name: Upload math result for job 1
uses: actions/upload-artifact@v1
with:
name: homework
path: math-homework.txt

job_2:
name: Multiply by 9
needs: job_1
runs-on: windows-latest
steps:
- name: Download math result for job 1
uses: actions/download-artifact@v1
with:
name: homework
- shell: bash
run: |
value=`cat homework/math-homework.txt`
expr $value \* 9 > homework/math-homework.txt
- name: Upload math result for job 2
uses: actions/upload-artifact@v1
with:
name: homework
path: homework/math-homework.txt

job_3:
name: Display results
needs: job_2
runs-on: macOS-latest
steps:
- name: Download math result for job 2
uses: actions/download-artifact@v1
with:
name: homework
- name: Print the final result
shell: bash
run: |
value=`cat homework/math-homework.txt`
echo The result is $value

0 comments on commit 1f6b2be

Please sign in to comment.