Add action to fire when a published post is updated

As an alternative, you can make use of the ‘transition_post_status’ hook for this. This hook is fired whenever a post’s status is changed. In your case, you need to check whether the old and new status of the post is the same, which is publish

You can also set conditionals according to $post, which is the current post being updated/published etc.

You can try the following:

add_action('transition_post_status', function ($new_status, $old_status, $post) {

   if ( $old_status == 'publish' && $new_status == 'publish' ) {
       //Do something when post is updated
   }

}, 10, 3 );