publish before writing to file