Convert publish script to Bash script