跳到主要内容

Artifacts and Cache

This document introduces the artifact and cache mechanisms of AtomGit Action, used to pass build outputs across Jobs and speed up dependency installation.

Artifacts​

Artifacts are files generated during a Workflow run, which can be passed across Jobs:

steps:
- name: Upload artifact
uses: upload-artifact
with:
name: build-output
path: dist/

- name: Download artifact
uses: download-artifact
with:
name: build-output
path: ./app

Cache​

Cache is used to speed up dependency installation and avoid repeated downloads:

steps:
- name: Use cache
uses: cache
with:
key: npm-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
path: ~/.npm
restore-keys: |
npm-${{ runner.os }}-

Artifacts vs Cache​

FeatureArtifactsCache
PurposePass build outputs (across Jobs)Speed up dependency installation (across runs)
LifecycleCan set retention daysLong-term retention, LRU eviction
Access ScopeBetween Jobs in the same WorkflowAcross all runs in the same repository