add publish method for selectively writing files