I'm trying to setup a TeamCity continuous integration and deployment workflow with a Laravel application using Git for version control but the way I've managed to do it feels hacky.
What I have right now is a TeamCity build with a trigger of a push to the development branch. I have setup three build events which ssh to the staging server then git pull the code, run artisan migrate then run the phpunit tests.
In each build event it has to ssh to the staging server, cd to the directory and then perform the action which doesn't seem right, furthermore if something goes wrong like the phpunit tests failing, there is no way to rollback easily. So what exactly is the right way, I've tried researching but can't find anything that actually explains how you would use git for deploying the live code, would you even use git for deploying?