Fix last tag detection in publish script