Hello Javier,
with the help of a condition tree you make this this happen. Once your actions runs and you check the response code, if it passes it will go to the next action to deploy, However in case of failure you can add an ROC action called "ROC - Fail Deployment Step" this action fails the deployment step which is running this flow.
you can see the screen shots for reference.
One more thing, at the time you are putting this condition, that action should be set, "Not to pause when Fail". in above case action "Create Artifact in Repository" is set not to pause when fail.