A software artifact is a generated output retained or transferred by a development workflow. Artifacts include compiled binaries, container images, packages, deployment descriptors, and arbitrary files such as ZIP archives. CI produces them after source retrieval, building, testing, and packaging; CD consumes a consistent, versioned set for deployment. section 8.4.2 section 8.0 section 9.4
Use different artifact types for different handoffs. Container images and packages can be published to registries, while workflow storage can retain files for later jobs or workflows. A release packages deployment-ready artifacts as an explicit handoff, helping tie deployed files back to source changes and version numbers. section 8.3.5 section 8.5.6 section 8.5.8
Prepare artifacts so they are usable, traceable, and safe to promote:
- Build production-focused outputs separately from debug builds; removing debug information reduces artifact size and avoids a potential security risk. section 8.3.5
- Generate deployment descriptors during CI by replacing template tokens with the exact container tags produced by the build. section 8.5.7
- Attach deployment files and other deployable outputs to a versioned release after successful CI checks, then let that release trigger CD. section 8.5.8 section 8.7
- Set retention deliberately for temporary workflow artifacts; storage is billable, defaults to 90 days, and can be shortened after outputs reach packages or releases. section 12.2
Passing a deployment file between jobs
A build job creates a file and uploads it with actions/upload-artifact under a chosen name. A deploy job that depends on the build uses actions/download-artifact with that name, making the generated file available without rebuilding it. section 8.5.6
Listing 8.14 Uploading artifacts to GitHub
name: Upload and Download arbitrary artifacts
on:
workflow_dispatch:
env:
deploymentFile: 'file-I-want-to-use-in-deploy-phase.txt'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: create a file we will use in next job
run: |
touch ${{github.workspace}}/${{env.deploymentFile}}
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
name: deployfile
path: ${{github.workspace}}/${{env.deploymentFile}}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: deployfile
- name: show files downloaded
run: |
ls ${{github.workspace}}
The workflow listing shows the complete upload-and-download pattern: create a file, name and upload it in the build job, then retrieve it in the dependent deploy job. section 8.5.6



