feat: Add Heroku Review Apps support for preview deployments (#11304)

- Add pr-predeploy script and review environment config in app.json
- Use smaller addon tiers for review apps to reduce costs
- Auto-derive URL from HEROKU_APP_NAME when URL is not set
- Make URL optional for review apps

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Tom Moor
2026-01-29 21:08:35 -05:00
committed by GitHub
parent 7b6293637c
commit 4aa4868a54
2 changed files with 30 additions and 4 deletions
+22 -2
View File
@@ -20,9 +20,25 @@
"plan": "heroku-postgresql" "plan": "heroku-postgresql"
} }
], ],
"scripts": {
"postdeploy": "yarn sequelize db:migrate",
"pr-predeploy": "yarn sequelize db:migrate"
},
"environments": {
"review": {
"scripts": { "scripts": {
"postdeploy": "yarn sequelize db:migrate" "postdeploy": "yarn sequelize db:migrate"
}, },
"addons": [
{
"plan": "heroku-redis:mini"
},
{
"plan": "heroku-postgresql:essential-0"
}
]
}
},
"env": { "env": {
"NODE_ENV": { "NODE_ENV": {
"value": "production", "value": "production",
@@ -43,8 +59,12 @@
"required": true "required": true
}, },
"URL": { "URL": {
"description": "https://{your app name}.herokuapp.com, or the domain you are binding to", "description": "https://{your app name}.herokuapp.com, or the domain you are binding to. For review apps, this is auto-generated.",
"required": true "required": false
},
"HEROKU_APP_NAME": {
"description": "Automatically set by Heroku for review apps",
"required": false
}, },
"GOOGLE_CLIENT_ID": { "GOOGLE_CLIENT_ID": {
"description": "See https://developers.google.com/identity/protocols/OAuth2 to create a new Google OAuth client. You must configure at least one of Slack or Google to control login.", "description": "See https://developers.google.com/identity/protocols/OAuth2 to create a new Google OAuth client. You must configure at least one of Slack or Google to control login.",
+7 -1
View File
@@ -200,6 +200,7 @@ export class Environment {
/** /**
* The fully qualified, external facing domain name of the server. * The fully qualified, external facing domain name of the server.
* If not set, will be derived from HEROKU_APP_NAME for Heroku deployments.
*/ */
@Public @Public
@IsNotEmpty() @IsNotEmpty()
@@ -208,7 +209,12 @@ export class Environment {
require_protocol: true, require_protocol: true,
require_tld: false, require_tld: false,
}) })
public URL = (environment.URL ?? "").replace(/\/$/, ""); public URL = (
environment.URL ??
(environment.HEROKU_APP_NAME
? `https://${environment.HEROKU_APP_NAME}.herokuapp.com`
: "")
).replace(/\/$/, "");
/** /**
* If using a Cloudfront/Cloudflare distribution or similar it can be set below. * If using a Cloudfront/Cloudflare distribution or similar it can be set below.