Add local publishing and refactor publish module interface