First attempt at the actual publish script with some tests