For deploying code to a server I run a script which scp's the deployment file onto the server using my private key .
But after scp I have to manually ssh to the machine 
 sudo to a superuser account and run a deployment script .

I would like to automate the second step too , but cannot figure out how to .

Any other alternatives to this two step process ?