Skip to content

Commit

Permalink
cdktf: specify deploy environment via environment variable (#187)
Browse files Browse the repository at this point in the history
* Reorder imports

* Build both spotlight and doj-demo on main and stable

* Remove "deploy" call from Dockerfile.
Context: I don't recall why this is here, but we'll find out soon

* Add "pnpm deploy" step

* Add separate workspaces for main and staging, and separate scripts for main and staging environments.

* Fix type error on story

* Use environment variables to distinguish separate deployment environments.
  • Loading branch information
danielnaab authored Jun 14, 2024
1 parent ecedaa5 commit 9cca8fd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
8 changes: 4 additions & 4 deletions infra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"build": "pnpm build:tsc && pnpm build:synth",
"build:get": "cdktf get",
"build:synth": "pnpm build:synth:main && pnpm build:synth:staging",
"build:synth:main": "cdktf synth --app 'npx ts-node src/spaces/main.ts'",
"build:synth:staging": "cdktf synth --app 'npx ts-node src/spaces/staging.ts'",
"build:synth:main": "DEPLOY_ENV=dev cdktf synth",
"build:synth:staging": "DEPLOY_ENV=staging cdktf synth",
"build:tsc": "tsc --pretty",
"clean": "rm -rf .gen cdktf.out",
"deploy:main": "cdktf deploy --app 'npx ts-node src/spaces/main.ts'",
"deploy:staging": "cdktf deploy --app 'npx ts-node src/spaces/staging.ts'",
"deploy:main": "DEPLOY_ENV=dev cdktf deploy",
"deploy:staging": "DEPLOY_ENV=staging cdktf deploy",
"dev": "tsc -w",
"test": "jest",
"test:watch": "jest --watch"
Expand Down
18 changes: 18 additions & 0 deletions infra/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { App } from 'cdktf';

const app = new App();

const deployEnv = process.env.DEPLOY_ENV;

switch (deployEnv) {
case 'dev':
import('./spaces/main');
break;
case 'staging':
import('./spaces/staging');
break;
default:
throw new Error('Please specify a valid environment');
}

app.synth();
1 change: 1 addition & 0 deletions packages/design/src/Form/ActionBar/ActionBar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default {
{
type: 'submit',
text: 'Submit',
submitAction: 'submit',
},
],
},
Expand Down

0 comments on commit 9cca8fd

Please sign in to comment.