I'm trying to setup a new rails project to have three environments: staging, test, and production. I want to host on Heroku, and use GitHub for source control. The basic workflow I want is to:
1) Develop on a local environment
2) Push to the staging branch on GitHub, kicking off a build on the staging server.
3) Merge staging into test on GitHub kicking off my tests first and then building on the test server if they're successful.
4) Merge test into production kicking off a build of the production server.
I also own the domain I want to use and I want the servers to reflect this. So I'd want my production app to be at example.com, while my test server would be test.example.com, and my staging server would be staging.example.com.
Does anyone know how I'd set all this up even at a high level? I know it's a lot of stuff with potentially many ways to do it.