Refactor and fix the GitHub pages publication routine