I'm using Heroku + Rails 5.1. I just want my postdeploy script written in app.json to run only in Review Apps environment.
app. json is a manifest format for describing web apps. It declares environment variables, add-ons, and other information required to run an app on Heroku. This document describes the schema in detail.
Review apps each have a unique URL you can share, making them a great way to propose, test, and merge changes to your code base. You can configure review apps to spin up automatically for each pull request, or you can create them manually from your app's Pipeline page in the Heroku Dashboard.
I have done something like this by setting a config var in my staging environment (the parent for my review apps) which tells my postdeploy that it is not in production. I added the cli webpack to app.json and inside my postdeploy I get the value of that config var and then conditionally execute code. In production, we set a different var.
You could also just check the $HEROKU_PARENT_APP_NAME inside the review app (you must have this env var defined in app.json for it to appear in review app), and if the parent app == staging (or whatever), don't execute whatever is in your post deploy
good luck, getting review apps to work right can be a huge pain
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With