how does publishing work