revised publish script [skip ci]