In case of deployment failure follow these steps to roll back changes:
Detect the specific issues and if you are using version control (e.g., Git) in your app, revert to the previous latest version.
Before proceeding with the rollback, make sure to have data backups and configurations.
Revert the database to its previous state utilizing database versioning or backups (in case database changes were part of the deployment).
Revert the code changes by deploying to the last known stable version.
Prepare the rollback script before automating the process and quickly revert changes.
Don’t forget to inform the stakeholders about the rollback.
Conduct detailed testing to make sure the app is stable.
Comprehend the root cause and implement the improvements to prevent future issues.