I’m trying to set up autodeploys for two different branches / to two different heroku apps for the same codebase.
autodeploys should happen to the staging app from the main branch.
autodeploys should happen to the production app from the production branch.
I’ve read the docs here which are pretty clear for a single app, but what about multiple apps/branches?
Right now I have
version: 2.1
orbs:
browser-tools: circleci/browser-tools@1.1.3
commands:
...
jobs:
...
deploy:
machine:
enabled: true
working_directory: ~/
environment:
HEROKU_APP: $HEROKU_APP_NAME # How do I make this dynamic per branch / app??
steps:
- checkout
- run:
command: |
git push staging main # How do I make this dynamic per branch / app??
heroku run rake db:migrate # How do I make this dynamic per branch / app??
sleep 5 # sleep for 5 seconds to wait for dynos
heroku restart
workflows:
version: 2
build_lint_and_test:
jobs:
- build
- lint:
requires:
- build
- test:
requires:
- build
- jest:
requires:
- build
- deploy:
requires:
- build
filters:
branches:
only:
- main
- production
How do I make this dynamic for both branches/apps? Is this possible?