before_publish callback