About workflow artifacts
An artifact is a file or collection of files produced during a workflow run. Artifacts allow you to persist data after a job has completed, and share that data with another job in the same workflow. For example, you can use artifacts to save your build and test output after a workflow run has ended.
GitHub provides two actions that you can use to upload and download build artifacts, upload-artifact and download-artifact.
Common artifacts include:
- Log files and core dumps
- Test results, failures, and screenshots
- Binary or compressed files
- Stress test performance output and code coverage results
比较构件和依赖项缓存
构件与缓存类似,因为它们能够在 GitHub 上存储文件,但每项功能都提供不同的用例,不能互换使用。
- 当想要重复使用在作业或工作流运行之间不频繁更改的文件时(例如从程序包管理系统构建依赖项),请使用缓存。
- 如果要保存作业生成的文件,以在工作流运行结束后查看(例如生成的二进制文件或生成日志),请使用项目。
For more information on dependency caching, see Dependency caching reference.
Generating artifact attestations for builds
项目证明使你能够为自己构建的软件创建不可伪造的来源和完整性保证。 反过来,使用软件的人员可以验证软件是在哪里以及如何构建的。
使用软件生成项目证明时,将创建加密签名的声明用于确立生成的来源,并包含以下信息:
- 指向与项目关联的工作流的链接。
- 项目的存储库、组织、环境、提交 SHA 以及触发事件。
- OIDC 令牌中用于确立来源的其他信息。 有关详细信息,请参阅“OpenID Connect”。
还可以生成包含关联的软件物料清单 (SBOM) 的项目证明。 将你的版本与它们中使用的开放源代码依赖项列表相关联可提供透明度,并使使用者能够遵守数据保护标准。
You can access attestations after a build run, underneath the list of the artifacts the build produced.
For more information, see 使用项目证明确立生成的来源.
已删除的工作流运行中的工件
删除某个工作流运行时,也会从存储中删除与该运行关联的所有工件。 可以使用 GitHub Actions UI、REST API 或使用 GitHub CLI 删除工作流运行,请参阅“删除工作流程运行”、删除工作流运行或 gh run delete。