In a CodeBuild buildspec, never rely on cd from a previous command line; chain commands with && in a single line. And remember post_build runs even on failure, so guard any notify-or-publish step on the build status variable.

Context: From a community AWS CI/CD guide. Each command in a CodeBuild buildspec runs in its own shell, so a cd in one command does not persist to the next. Chaining with && or putting the work in one command block is the fix. The same guide notes post_build runs even when the build phase failed (guard on CODEBUILD_BUILD_SUCCEEDING), and that a missing artifacts block means later stages never see your output.