One job per script, named by its file
A file called build.sh that builds one thing is reviewable on its own. A giant script with twelve modes has state that only makes sense in the middle, and that is the kind of script nobody can hand over.
Leave the tree cleaner than you left it
Clean up temporary folders on exit, including on failure. A script that leaves debris behind fails the next run, and a failure that is caused by leftover state is the kind that makes automation untrustworthy.