Action on post publish

If your aim is to trigger code when a post is published, as in, the post_status of the post is set to publish, then you can hook into save_post like this:

function cc_publish_wpse_263985( $postid ) {

    // check if post status is 'publish'
    if ( get_post_status( $postid ) == 'publish')  ) {

        // do something here

    }

}
add_action( 'save_post', 'cc_publish_wpse_263985' );