wp_update_post ignores if/else

How is this possible?

I can think of one possibility that for some reason ur page is getting auto reloaded. So the flow of execution is like: you access the page, your code gets executed changing status from draft to published, then some other code gets executed and the page is reloaded. This time when your code gets executed it sees the post is already published and outputs the msg accordingly.

Along with echo statements try using error_log as well and see what you get in the log.

Also you can check developer tools > network tab in your browser if the page is getting auto reloaded or not.