Extract publish_node in its own function

This function extracts the Node.Update logic for `publish_node` into a
separate function, so that we can use it in a `POST` request, i.e. a new
endpoint for publishing nodes.
4 jobs for adinapoli/issue-425 in 61 minutes and 31 seconds (queued for 11 minutes)
Status Job ID Name Coverage
  Cabal
passed #15971
cabal

00:25:21

 
  Stack
passed #15972
stack

00:08:23

 
  Bench
manual #15973
allowed to fail manual
bench
 
  Test
passed #15974
test

00:27:45