Added example of archiving artifacts in Github Actions

This commit is contained in:
Tomasz 2023-05-17 22:54:58 +02:00
parent fa535a10ac
commit 4fee50befa
2 changed files with 26 additions and 45 deletions

View File

@ -103,7 +103,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 4,
"id": "f4916c1f", "id": "f4916c1f",
"metadata": { "metadata": {
"slideshow": { "slideshow": {
@ -621,7 +621,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 11,
"id": "245f7c8a", "id": "245f7c8a",
"metadata": { "metadata": {
"slideshow": { "slideshow": {
@ -633,7 +633,7 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "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", " # Use the output from the `hello` step\n",
" - name: Get the output time\n", " - name: Get the output time\n",
" run: echo \"The time was ${{ steps.hello.outputs.time }}\" > time.txt\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", " - name: Archive artifacts\n",
" uses: actions/upload-artifact@v3\n", " uses: actions/upload-artifact@v3\n",
" with:\n", " with:\n",
" name: figlet-output\n", " name: figlet-output\n",
" path: |\n", " path: |\n",
" figlet.txt\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", "cell_type": "code",
"execution_count": 89, "execution_count": 12,
"id": "47e301f9", "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": { "metadata": {
"slideshow": { "slideshow": {
"slide_type": "slide" "slide_type": "slide"
@ -718,23 +699,23 @@
"name": "stdout", "name": "stdout",
"output_type": "stream", "output_type": "stream",
"text": [ "text": [
"[main 2fe0183] Fix\n", "[main 5a40228] Archive in one job, use in other\n",
" 1 file changed, 4 insertions(+)\n", " 1 file changed, 1 insertion(+)\n",
"Enumerating objects: 9, done.\n", "Enumerating objects: 9, done.\n",
"Counting objects: 100% (9/9), done.\n", "Counting objects: 100% (9/9), done.\n",
"Delta compression using up to 4 threads\n", "Delta compression using up to 4 threads\n",
"Compressing objects: 100% (5/5), done.\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", "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", "remote: Resolving deltas: 100% (2/2), completed with 2 local objects.\u001b[K\n",
"To github.com:TomekZet/ium-ga-hello.git\n", "To github.com:TomekZet/ium-ga-hello.git\n",
" b5a265f..2fe0183 main -> main\n" " 4df6dc0..5a40228 main -> main\n"
] ]
} }
], ],
"source": [ "source": [
"!git add -u\n", "!git add -u\n",
"!git commit -m \"Fix\"\n", "!git commit -m \"Archive in one job, use in other\"\n",
"!git push" "!git push"
] ]
}, },

@ -1 +1 @@
Subproject commit 2fe01837da8bb844e05fb9bf7f12fd37a124a236 Subproject commit 5a40228be54897d47e0480318adcdbdec0e74d60