From 2820d0c5238773a2e5dd2567572d75d64e5f4cb1 Mon Sep 17 00:00:00 2001 From: Muhammad Sameer Ali <32276372+msali123@users.noreply.github.com> Date: Sat, 30 Sep 2023 01:23:04 +0500 Subject: [PATCH] Blog - Uploading and Downloading Artifacts with GitHub Actions (#671) * Created new blog, added content & author * Resolved lint warnings * Made images wide with CC * Added CTA * Added keywords for intenral links * Added header & other images --- .../2023-10-05-github-action-artifacts.md | 276 ++++++++++++++++++ .../github-action-artifacts/526Vt3o.png | Bin 0 -> 106214 bytes .../github-action-artifacts/6VKJXqO.png | Bin 0 -> 109042 bytes .../github-action-artifacts/6hYF97b.png | Bin 0 -> 111685 bytes .../github-action-artifacts/Df5GvyR.png | Bin 0 -> 96854 bytes .../github-action-artifacts/THlckxH.png | Bin 0 -> 190425 bytes .../github-action-artifacts/UsmtQbk.png | Bin 0 -> 210012 bytes .../github-action-artifacts/fDoAlVh.png | Bin 0 -> 139699 bytes .../github-action-artifacts/gALcTcP.png | Bin 0 -> 111518 bytes .../images/github-action-artifacts/header.jpg | Bin 0 -> 524071 bytes .../github-action-artifacts/up & down.png | Bin 0 -> 104165 bytes .../github-action-artifacts/workflow.png | Bin 0 -> 70940 bytes 12 files changed, 276 insertions(+) create mode 100644 blog/_posts/2023-10-05-github-action-artifacts.md create mode 100644 blog/assets/images/github-action-artifacts/526Vt3o.png create mode 100644 blog/assets/images/github-action-artifacts/6VKJXqO.png create mode 100644 blog/assets/images/github-action-artifacts/6hYF97b.png create mode 100644 blog/assets/images/github-action-artifacts/Df5GvyR.png create mode 100644 blog/assets/images/github-action-artifacts/THlckxH.png create mode 100644 blog/assets/images/github-action-artifacts/UsmtQbk.png create mode 100644 blog/assets/images/github-action-artifacts/fDoAlVh.png create mode 100644 blog/assets/images/github-action-artifacts/gALcTcP.png create mode 100644 blog/assets/images/github-action-artifacts/header.jpg create mode 100644 blog/assets/images/github-action-artifacts/up & down.png create mode 100644 blog/assets/images/github-action-artifacts/workflow.png diff --git a/blog/_posts/2023-10-05-github-action-artifacts.md b/blog/_posts/2023-10-05-github-action-artifacts.md new file mode 100644 index 000000000..de9529b76 --- /dev/null +++ b/blog/_posts/2023-10-05-github-action-artifacts.md @@ -0,0 +1,276 @@ +--- +title: "Uploading and Downloading Artifacts with GitHub Actions" +categories: + - Tutorials +toc: true +author: Kumar Harsh + +internal-links: + - downloading artifacts + - uploading artifacts + - downloading artifacts with github actions + - uploading artifacts with github actions +--- + +If you've worked with projects hosted on GitHub, you're probably aware of [GitHub Actions](https://github.com/features/actions). GitHub Actions is GitHub's recommended way of setting up build automation and workflows from your GitHub-hosted repo. It supports multiple triggers and operations, including uploading and downloading artifacts. + +Artifacts represent the final or intermediate products of these build pipelines. In a build pipeline, the artifacts typically consist of executable binaries created at its end. Conversely, a test pipeline might generate artifacts in the form of test logs and results as files. These artifacts can then be used to update statuses across pull requests or commits. Some more use cases where uploading/downloading artifacts might come in handy include the following: + +* **Test results and coverage reports:** to review test outcomes, track code coverage trends, and share test reports with your team. +* **Deployment packages:** to store the deployable assets and facilitate subsequent deployment steps or manual releases. +* **Logs and diagnostics:** for troubleshooting and investigating issues that occur during the workflow runs. +* **Generated documentation or reports:** to make these accessible for review, dissemination, or archiving. +* **Storage of intermediate results:** to allow subsequent steps or workflows to access and use the data. +* **Sharing of artifacts across workflows or jobs.** + +In this article, you'll learn how to use artifacts with GitHub Actions to capture data from workflows and how to upload and download them as necessary using the [`actions/upload-artifact@v3`](https://github.com/actions/upload-artifact) and [`actions/download-artifact@v3`](https://github.com/actions/download-artifact) actions. + +## How to Use Artifacts with GitHub Actions + +In this tutorial, you'll learn how to use the upload and download artifacts actions to upload build results from one job and download them in another. This creates a release for every tag created in a GitHub repo. + +To follow along, all you need is a GitHub account. Because you'll write the workflow in the GitHub web app, you don't need any local development setup. However, you do need [git](https://git-scm.com/) installed on your local system so that you can clone the demo repo you will create in the tutorial and create tags in it. + +### How to Use Artifacts to Capture Data from Workflows + +Start by uploading artifacts from GitHub Actions workflows. You need to [fork this repo](https://github.com/krharsh17/gh-actions-upload-download/) to your GitHub account. This repo contains a [Vite](https://vitejs.dev/)-based [Vue](https://vuejs.org/) app that you can use. You'll generate a production build of this app using the workflow you create in this section. The static build output files are packaged and uploaded to GitHub for every workflow run using the `actions/upload-artifact@v3` action. + +#### Set Up the Workflow + +![Workflow]({{site.images}}{{page.slug}}/workflow.png)\ + +To get started, click on **Add file > Create new file** on the home page of the forked repo: + +
fwajxM5zNY4B
zx5FW^uVS5I89+8Tpo9Pz6lk+}X|4~zI P%XE2;Mrv7zDpg~2QZL$@h$)a16da44P7`-zhuA^v9?p#0ZA^tg(VvWEJYWuvsb@3oeCG
z@T*fmBWLdRmk%`;q%>}eow)O5ail8{-+ZT3dZ#6lhIw*+_I;|Yi=(Mf8sDZBLao4F
z=9m1NAI5Ec%XAi>jkTBxQfsu3?)9zF%wms`rrcWIv`)iWs2z?XmJ-Qo$Wh1m*wE8n
zm+_L#Z9SSw4(^!hQ~WlF>Isj!**xIF8R)e>SVh#7Nr-O;noehHVTXe^Si^Y0cb-67
z<6)=L81P`;FO6>6K~N)6jDErD2(QmF*