Skip to content

Commit 43ea4d8

Browse files
committed
initial deployment
1 parent c06f3be commit 43ea4d8

26 files changed

+9784
-2
lines changed

.github/workflows/check_base.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
working-directory:
5+
type: string
6+
required: true
7+
8+
environment:
9+
type: string
10+
required: true
11+
12+
aws-region:
13+
type: string
14+
required: true
15+
16+
defaults:
17+
run:
18+
shell: bash
19+
20+
jobs:
21+
cdk_deploy:
22+
name: "Check CDK"
23+
runs-on: ubuntu-latest
24+
environment: ${{ inputs.environment }}
25+
steps:
26+
- name: "Checkout"
27+
uses: actions/checkout@v4
28+
29+
- name: "Setup Node"
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 18
33+
34+
- name: "Setup CDK"
35+
run: yarn global add aws-cdk
36+
37+
- name: "Print directory structure and file contents"
38+
working-directory: ${{ inputs.working-directory }}
39+
run: |
40+
echo "Directory structure and file contents:"
41+
ls -R
42+
43+
- name: "Install All Dependencies"
44+
working-directory: ${{ inputs.working-directory }}
45+
run: |
46+
echo "Installing all dependencies..."
47+
yarn installall
48+
49+
- name: "Build All Components"
50+
working-directory: ${{ inputs.working-directory }}
51+
run: |
52+
echo "Building all components..."
53+
yarn buildall
54+
55+
- name: "Synthesize"
56+
working-directory: ${{ inputs.working-directory }}
57+
run: |
58+
cdk synth || { echo "CDK synth failed"; exit 1; }

.github/workflows/deploy_base.yaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
working-directory:
5+
type: string
6+
required: true
7+
8+
environment:
9+
type: string
10+
required: true
11+
12+
aws-region:
13+
type: string
14+
required: true
15+
16+
secrets:
17+
AWS_ACCESS_KEY_ID:
18+
required: true
19+
20+
AWS_SECRET_ACCESS_KEY:
21+
required: true
22+
23+
MANAGEMENT_API_KEY:
24+
required: true
25+
26+
defaults:
27+
run:
28+
shell: bash
29+
30+
jobs:
31+
cdk_deploy:
32+
name: "Deploy to AWS"
33+
runs-on: ubuntu-latest
34+
environment: ${{ inputs.environment }}
35+
steps:
36+
- name: "Checkout"
37+
uses: actions/checkout@v4
38+
39+
- name: "Setup Node"
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: 18
43+
44+
- name: "Setup CDK"
45+
run: yarn global add aws-cdk
46+
47+
- name: "Install All Dependencies"
48+
working-directory: ${{ inputs.working-directory }}
49+
run: |
50+
yarn installall
51+
52+
- name: "Build All Components"
53+
working-directory: ${{ inputs.working-directory }}
54+
run: |
55+
yarn buildall
56+
env:
57+
DEPLOYMENT_STAGE: ${{ inputs.environment }}
58+
59+
- name: "Clean CDK Output"
60+
working-directory: ${{ inputs.working-directory }}
61+
run: |
62+
rm -rf cdk.out
63+
64+
- name: "Synthesize Stack"
65+
working-directory: ${{ inputs.working-directory }}
66+
run: |
67+
cdk synth || { echo "CDK synth failed"; exit 1; }
68+
69+
- name: "Configure AWS Credentials"
70+
uses: aws-actions/configure-aws-credentials@v4
71+
with:
72+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
73+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
74+
aws-region: ${{ inputs.aws-region }}
75+
76+
- name: "Deploy Stack"
77+
working-directory: ${{ inputs.working-directory }}
78+
run: |
79+
export AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}
80+
export AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}
81+
export STAGE=${{ inputs.environment }}
82+
export REGION=${{ inputs.aws-region }}
83+
export MANAGEMENTAPIKEY=${{ secrets.MANAGEMENT_API_KEY }}
84+
85+
yarn cdk deploy --require-approval never || { echo "CDK deploy failed"; exit 1; }

.github/workflows/dev_check.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: "Dev Check"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
check:
10+
uses: ./.github/workflows/check_base.yaml
11+
with:
12+
working-directory: .
13+
environment: "dev"
14+
aws-region: "ap-southeast-2"

.github/workflows/dev_deploy.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "Development Deployment"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
deploy:
10+
uses: ./.github/workflows/deploy_base.yaml
11+
with:
12+
working-directory: .
13+
environment: "dev"
14+
aws-region: "ap-southeast-2"
15+
secrets:
16+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
17+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
18+
MANAGEMENT_API_KEY: ${{ secrets.MANAGEMENT_API_KEY }}

.github/workflows/prod_deploy.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "Production Deployment"
2+
3+
on:
4+
push:
5+
branches:
6+
- prod
7+
8+
jobs:
9+
deploy:
10+
uses: ./.github/workflows/deploy_base.yaml
11+
with:
12+
working-directory: .
13+
environment: "prod"
14+
aws-region: "ap-southeast-2"
15+
secrets:
16+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
17+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
18+
MANAGEMENT_API_KEY: ${{ secrets.MANAGEMENT_API_KEY }}

.github/workflows/qas_deploy.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "QAS Deployment"
2+
3+
on:
4+
push:
5+
branches:
6+
- qas
7+
8+
jobs:
9+
deploy:
10+
uses: ./.github/workflows/deploy_base.yaml
11+
with:
12+
working-directory: .
13+
environment: "qas"
14+
aws-region: "ap-southeast-2"
15+
secrets:
16+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
17+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
18+
MANAGEMENT_API_KEY: ${{ secrets.MANAGEMENT_API_KEY }}

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
cdk.out
3+
**/*.js
4+
.vscode/*
5+
.env

0 commit comments

Comments
 (0)