From 4fee50befa7a2a195db86b4e57b30f6eddc09874 Mon Sep 17 00:00:00 2001 From: Tomasz Date: Wed, 17 May 2023 22:54:58 +0200 Subject: [PATCH] Added example of archiving artifacts in Github Actions --- IUM_11.CML.ipynb | 69 ++++++++++++++----------------------- IUM_11/github-actions-hello | 2 +- 2 files changed, 26 insertions(+), 45 deletions(-) diff --git a/IUM_11.CML.ipynb b/IUM_11.CML.ipynb index 3f244d5..e5cdd6d 100644 --- a/IUM_11.CML.ipynb +++ b/IUM_11.CML.ipynb @@ -103,7 +103,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 4, "id": "f4916c1f", "metadata": { "slideshow": { @@ -621,7 +621,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 11, "id": "245f7c8a", "metadata": { "slideshow": { @@ -633,7 +633,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "Writing .github/workflows/docker-artifact.yml\n" + "Overwriting .github/workflows/docker-artifact.yml\n" ] } ], @@ -662,52 +662,33 @@ " # Use the output from the `hello` step\n", " - name: Get the output time\n", " run: echo \"The time was ${{ steps.hello.outputs.time }}\" > time.txt\n", - " archive:\n", - " name: \"Archive the artifacts\"\n", - " runs-on: ubuntu-latest\n", - " needs: hello-job\n", - " steps:\n", - " - name: diagnose\n", - " run: pwd; ls -la\n", " - name: Archive artifacts\n", " uses: actions/upload-artifact@v3\n", " with:\n", " name: figlet-output\n", " path: |\n", " figlet.txt\n", - " time.txt\n" + " time.txt\n", + " publish:\n", + " name: \"Publish as github comment\"\n", + " runs-on: ubuntu-latest\n", + " needs: hello-job\n", + " steps:\n", + " - uses: actions/checkout@v3\n", + " #We need to download the artifact first, jobs do not share workflow files\n", + " - name: get-artifact \n", + " uses: actions/download-artifact@v3\n", + " with:\n", + " name: figlet-output\n", + " - name: display_artifact_contents\n", + " run:\n", + " cat time.txt ; tr ' ' '#' < figlet.txt\n" ] }, { "cell_type": "code", - "execution_count": 89, + "execution_count": 12, "id": "47e301f9", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Enumerating objects: 13, done.\n", - "Counting objects: 100% (13/13), done.\n", - "Delta compression using up to 4 threads\n", - "Compressing objects: 100% (7/7), done.\n", - "Writing objects: 100% (7/7), 792 bytes | 792.00 KiB/s, done.\n", - "Total 7 (delta 3), reused 0 (delta 0), pack-reused 0\n", - "remote: Resolving deltas: 100% (3/3), completed with 3 local objects.\u001b[K\n", - "To github.com:TomekZet/ium-ga-hello.git\n", - " 3b9c623..b5a265f main -> main\n" - ] - } - ], - "source": [ - "!git push" - ] - }, - { - "cell_type": "code", - "execution_count": 91, - "id": "580154ca", "metadata": { "slideshow": { "slide_type": "slide" @@ -718,23 +699,23 @@ "name": "stdout", "output_type": "stream", "text": [ - "[main 2fe0183] Fix\n", - " 1 file changed, 4 insertions(+)\n", + "[main 5a40228] Archive in one job, use in other\n", + " 1 file changed, 1 insertion(+)\n", "Enumerating objects: 9, done.\n", "Counting objects: 100% (9/9), done.\n", "Delta compression using up to 4 threads\n", "Compressing objects: 100% (5/5), done.\n", - "Writing objects: 100% (5/5), 564 bytes | 564.00 KiB/s, done.\n", + "Writing objects: 100% (5/5), 622 bytes | 622.00 KiB/s, done.\n", "Total 5 (delta 2), reused 0 (delta 0), pack-reused 0\n", "remote: Resolving deltas: 100% (2/2), completed with 2 local objects.\u001b[K\n", "To github.com:TomekZet/ium-ga-hello.git\n", - " b5a265f..2fe0183 main -> main\n" + " 4df6dc0..5a40228 main -> main\n" ] } ], "source": [ - "!git add -u \n", - "!git commit -m \"Fix\"\n", + "!git add -u\n", + "!git commit -m \"Archive in one job, use in other\"\n", "!git push" ] }, diff --git a/IUM_11/github-actions-hello b/IUM_11/github-actions-hello index 2fe0183..5a40228 160000 --- a/IUM_11/github-actions-hello +++ b/IUM_11/github-actions-hello @@ -1 +1 @@ -Subproject commit 2fe01837da8bb844e05fb9bf7f12fd37a124a236 +Subproject commit 5a40228be54897d47e0480318adcdbdec0e74d60