Only create the publish directory when actually publishing data

Thanks to Peter Bex for noticin that.