Problem
If a failure occurs during deployment, then the build script has already deleted the existing content.
Proposed Solution
The build script should build everything in a temporary directory, and then copy it over only once it has completed successfully.