Refine deploy workflow

I have looked at the models here.  I did not see any obvious method to do this.  If you have something in mind could you paste here or point me to the  right class.