publish: Improved deployment script.

generated from commit 784475aee59f92c902466d782c67804ed98d84f6