In order to ensure the quality of the code you deploy, make sure you don't deploy until you have got your code fully tested and received a "test passed".
There is more than one potential successful path to get work from "In Progress" to "Done" - what's important is that this process is consistent for a project and the whole team follows this process.
The Scrum Definition of Done is a great tool to document and promote this consistency, and the Sprint Retrospective meeting is the perfect opportunity to review and refine this document.
Here are some examples:
✅ Figure: Giving clients sole access to the deploy button, allows them to take ownership of the decision to deploy
For more information on this, see Rules to Successful Projects.