Skip to content

09 - Artifacts Workflow #754

09 - Artifacts Workflow

09 - Artifacts Workflow #754

name: 09 - Artifacts Workflow
on:
schedule:
- cron: "0 7 * * MON-FRI" # Runs at 7:00 UTC
workflow_dispatch:
jobs:
sum:
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@v2
with:
name: homework
path: math-homework.txt
multiplication:
name: Multiply by 9
needs: sum
runs-on: windows-latest
steps:
- name: Download math result for job 1
uses: actions/download-artifact@v2
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@v2
with:
name: homework
path: math-homework.txt
result:
name: Display results
needs: multiplication
runs-on: macOS-latest
steps:
- name: Download math result for job 2
uses: actions/download-artifact@v2
with:
name: homework
- name: Print the final result
shell: bash
run: |
value=`cat math-homework.txt`
echo The result is $value