Copy the deploy script changes from the 3.1 branch