How to have Heroku build my development branch on a staging server?

2.4k views Asked by At

I have a production application on master branch running all fine on heroku. I would like to run a second Heroku application but 'fed' from a local staging branch. These are the commands that i've run in my failed attempt to do this:

git checkout -b develop
heroku create --remote staging
git push staging develop

But because i'm pushing from a 'non master' branch it doesn't build the app;

remote: Pushed to non-master branch, skipping build.

I have read the managing multiple environments doc here; https://devcenter.heroku.com/articles/multiple-environments but it does not seem to address what I'm trying to achieve, rather merging develop branch into master first then pushing master to remote staging. I want to push my develop branch to a staging app and have it running live in RAILS_ENV=production mode, iteratively push to this live 'staging/testing' app then when i'm really comfy with what i'm going i'll merge the develop branch code into the master branch and push to the primary mast app.

Can anyone help me with how to achieve this?

3

There are 3 answers

2
Vijay Meena On

as per heroku doc

git push staging develop:master

0
James Keane On

Its not as close to the most direct command line - but my DevOps pipeline using Codeship makes this much easier for commits on different branches.

I have Codeship automatically deploy anything to the dev branch to one Heroku app, anything in the staging branch to another, and anything to master to the live branch.

Not the direct solution you were probably looking for - but something that shows the benefits of a good CI setup!

2
Bastien Vandamme On

as per Git documentaion

git push  <REMOTENAME> <LOCALBRANCHNAME>:<REMOTEBRANCHNAME>

so

git push heroku staging:master

means

push my staging local branch to master remote heroku branch