provide better impl of publish function in readme