From 4c36dda953e0df711c08cc06c13a145623066a82 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Fri, 17 May 2024 12:12:49 +0100 Subject: [PATCH] upload / download --- .github/workflows/data.yml | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/data.yml diff --git a/.github/workflows/data.yml b/.github/workflows/data.yml new file mode 100644 index 00000000..9ab02da7 --- /dev/null +++ b/.github/workflows/data.yml @@ -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@v4 + with: + name: homework_pre + 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@v4 + with: + name: homework_pre + - 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@v4 + with: + name: homework_final + path: 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@v4 + with: + name: homework_final + - name: Print the final result + shell: bash + run: | + value=`cat math-homework.txt` + echo The result is $value \ No newline at end of file