Skip to content

Commit 9896e7b

Browse files
committed
feat: add support for custom region in deploy executor
1 parent 2847ec3 commit 9896e7b

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

packages/nx-heroku/src/executors/deploy/schema.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export interface DeployExecutorSchema
66
config: Environment[];
77
// org not required to allow for personal apps
88
org?: string;
9+
region?: string;
910
repositoryName?: string;
1011
buildPacks: string[];
1112
variables?: Record<string, string>;

packages/nx-heroku/src/executors/deploy/schema.json

+20
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@
3838
"type": "string",
3939
"example": "my-org"
4040
},
41+
"region": {
42+
"description": "Heroku region, used to create the app. See https://devcenter.heroku.com/articles/regions for more information.",
43+
"type": "string",
44+
"example": "us",
45+
"default": "eu",
46+
"enum": [
47+
"us",
48+
"eu",
49+
"dublin",
50+
"frankfurt",
51+
"london",
52+
"montreal",
53+
"mumbai",
54+
"oregon",
55+
"singapore",
56+
"sydney",
57+
"tokyo",
58+
"virginia"
59+
]
60+
},
4161
"serviceUser": {
4262
"description": "Heroku team member used to automate deployment and manage|operate the deployed application. This user will be added to the app as a collaborator.",
4363
"format": "email",

packages/nx-heroku/src/executors/deploy/services/heroku-app.service.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class HerokuApp {
120120
//? allow custom commit message with format from 'util'
121121
// const COMMIT_MESSAGE_TEMPLATE = '%s(%s): %s';
122122
// format(COMMIT_MESSAGE_TEMPLATE, conf.type, conf.scope, conf.message);
123-
const path = `${this.appsDir}/${projectName}/${fileName}`;
123+
const path = join(this.appsDir, projectName, fileName);
124124
await exec(
125125
`git add ${path} && git commit -m "ci(${projectName}): add ${fileName}" -n --no-gpg-sign`
126126
);
@@ -151,7 +151,9 @@ class HerokuApp {
151151
if (buildPacks.includes(buildPackName)) {
152152
const srcPath = join(
153153
process.cwd(),
154-
`${this.appsDir}/${projectName}/${buildPackFile}`
154+
this.appsDir,
155+
projectName,
156+
buildPackFile
155157
);
156158
const destPath = join(process.cwd(), buildPackFile);
157159
const srcBuildPackFile = await readFile(srcPath, 'utf-8');
@@ -186,7 +188,7 @@ class HerokuApp {
186188
}
187189

188190
private async addRemote(): Promise<boolean> {
189-
const { appName, org, remoteName } = this.options;
191+
const { appName, org, remoteName, region } = this.options;
190192
try {
191193
await createAppRemote({ appName, remoteName });
192194
} catch (error) {
@@ -195,6 +197,7 @@ class HerokuApp {
195197
appName,
196198
org,
197199
remoteName,
200+
region,
198201
});
199202
this.logger.info(`Created app ${appName} on git remote ${remoteName}.`);
200203
return true;

0 commit comments

Comments
 (0)