- Welcome my DevOps blog./
- 🔰Posts/
- 🗂️My Trainings/
- VCS Trainings and Certifications/
- GitHub Actions - The Complete Guide/
- GitHub Actions: Job Artifacts & Outputs/
GitHub Actions: Job Artifacts & Outputs

Table of Contents
| External Resources » | ||
|---|---|---|
| GitHub Actions official Documentation | GitHub Actions Marketplace | GitHub.com |
Job Artifacts #
In simple terms, Job Artifacts are the outputs generated by Jobs. Those could be App binaries, compiled website files but also log files and any other Outputs.
Those Outputs can be used in Other jobs OR can be downloaded.
Uploading Job Artifacts #
Upload Actions Artifacts from your Workflow Runs.
📄 File: cicd-gh-actions-course/.github/workflows/04-01-artifacts-outputs.yml
build:
needs: test
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
working-directory: 04-react-exercise
- name: Build website
run: npm run build
working-directory: 04-react-exercise
- name: Upload artifact
uses: actions/upload-artifact@v5
with:
name: dist-files
path: 04-react-exercise/dist
Official Marketplace GitHub Action for uploading the artifacts: https://github.com/marketplace/actions/upload-a-build-artifact
Downloading Job Artifacts #
Download Actions Artifacts from your Workflow Runs (uploaded earlier by the job described in Uploading Job Artifacts).
Every job gets its own runner - it’s own Virtual Machine that’s totally isolated from other machines and jobs. For that reason Artifact must be first uploaded and then downloaded by another job.
📄 File: cicd-gh-actions-course/.github/workflows/04-01-artifacts-outputs.yml
deploy:
needs: build # Needs build jobe to complete first for the Artifact to be ready
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v5
with:
name: dist-files
Official Marketplace GitHub Action for downloading the artifacts: https://github.com/actions/download-artifact
More info: Store and share data with workflow artifacts
Job Outputs #
In addition to Artifacts, we also have the Job Outputs.
Difference between Artifacts and Job Outputs #
| Artifacts | Output files and folders. | Typically used for sharing log files, app binaries, etc. |
| Job Outputs | Output simple values. | Typically used for re-using a value in a different jobs. Example: Name of a file generated in a previous step. |
Defining Job Outputs #
📄 File: cicd-gh-actions-course/.github/workflows/04-01-artifacts-outputs.yml
| |
Using Job Outputs in other jobs #
📄 File: cicd-gh-actions-course/.github/workflows/04-01-artifacts-outputs.yml
| |
Caching dependencies #
actions/cache action in your workflow configuration.IMPORTANT:
- Caching can be used not only between Jobs but also between Workflows.
- Caching block is placed before the block that will be cached. In below example, it is
- name: Install dependencies. - Caching block must be used in every job to which this particular cache applies to.
See - name: Install dependencies block in below example.
📄 File: cicd-gh-actions-course/.github/workflows/04-01-artifacts-outputs.yml
| |
IMPORTANT: Every programming language and framework has its own way of caching.
More info:
Official Marketplace GitHub Action for caching: https://github.com/actions/cache
» Sources « #
- Store and share data with workflow artifacts - Use artifacts to share data between jobs in a workflow and store data once that workflow has completed.
- Official Marketplace GitHub Action for uploading the artifacts: https://github.com/marketplace/actions/upload-a-build-artifact
- Official Marketplace GitHub Action for downloading the artifacts: https://github.com/actions/download-artifact
- Official Marketplace GitHub Action for caching: https://github.com/actions/cache
» Disclaimer « #
This series draws heavily from Maximilian Schwarzmüller’s GitHub Actions - The Complete Guide course on Udemy.
| About the instructor: | |
|---|---|
| 🌐 Website | 📺 YouTube |
| 🗃️ GitHub |
| My Repos for this section: | |
|---|---|
| cicd-gh-actions-course | Learnings from "GitHub Actions - The Complete Guide" on Udemy. |
