Jobs run on separate machines with nothing shared, so passing a build between them means uploading it and downloading it again.
- uses: actions/upload-artifact@v2
with:
name: build
path: public/build
retention-days: 1
# in the next job
- uses: actions/download-artifact@v2
with: { name: build }
# 180 MB of node_modules: 40s up, 25s down. rebuilding: 30s.
Measuring is the only way to know which side of the line something falls on, and a large node_modules is reliably on the wrong side. retention-days is worth setting because the default is ninety and artifacts count against storage — a busy repository accumulates a surprising bill from build outputs nobody will ever download. Combining several jobs into one is frequently faster than passing artifacts between them, which is an unfashionable conclusion.