How to cancel deployment if any part of the build fails or throws an error?

I set up a tiny build script for my site at https://github.com/ReactFinland/future-frontend-site/blob/main/build.sh . The question is, how can I cancel the current deployment if any part of the script throws an error? Right now that's resulting in semi-working deploys that may be missing files.
GitHub
future-frontend-site/build.sh at main · ReactFinland/future-fronten...
Contribute to ReactFinland/future-frontend-site development by creating an account on GitHub.
3 Replies
bebraw
bebrawOP2y ago
Stack Overflow
Raise error in a Bash script
I want to raise an error in a Bash script with message "Test cases Failed !!!". How to do this in Bash? For example: if [ condition ]; then raise error "Test cases failed !!!" fi
bebraw
bebrawOP2y ago
nice, that's even better than spamming exit 1 (which seems to work) it would be cool if you could add a recipe with these sort of tricks to the docs
Want results from more Discord servers?
Add your server