I have three branches:
master (which is to be deployed to heroku prod app)
staging (which is to be deployed to heroku staging app)
development (no deployment)
I have included the following yml file in master and staging:
image: node:6.9.4
clone:
depth: full
pipelines:
default:
- step:
script: #default script to run
- echo "This default script will run when something is pushed to this branch"
branches:
master:
- step:
name: Heroku Production Deployment
caches:
- node
script: #deploy master branch to heroku prod app
- npm install
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_PROD_APP.git HEAD:master
staging:
- step:
name: Heroku Staging Deployment
caches:
- node
script: #deploy staging branch to heroku staging app
- npm install
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_STAGING_APP.git HEAD:staging
On development the .yml file only has the default value (since I do not want to deploy when anything is pushed to development branch).
When I make any changes in master (or anything is merged to master) the yml runs fine but only the prod app is updated.
When anything is merged to staging then again the master is deployed. Its like the staging branch deployment code never runs.
It says
git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_STAGING_APP.git HEAD:staging
remote: Pushed to non-master branch, skipping build.
But I want to build my heroku prod app from the master branch and my heroku staging app from my staging branch. How do I do this?