Build Once, Then Deploy the Artifact
In /home/student/repos/docs-site, .github/workflows/ship.yml has a build job and a deploy job. It's slow and risky:
deploy runs npm ci and npm run build a second time, so what it ships isn't the output that was tested.Change ship.yml so that:
build caches npm downloads between runs, keyed on the lockfile. Either actions/setup-node with cache: npm, or actions/cache with a key that uses hashFiles on package-lock.json.build uploads the dist directory as an artifact named dist after testing.deploy only runs after build succeeds, downloads the dist artifact, and runs ./deploy.sh dist without installing or building anything.Keep both jobs' other steps (checkout, tests, the deploy command).
About this machine
Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.
Part of CI/CD Pipelines in Practice. Next step: Pushed Commit Doesn't Start CI
Teaching or writing about this? Embed this lab on your page
Your machine is ready to start
A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.
No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.