publish function.