-
Notifications
You must be signed in to change notification settings - Fork 58
73 lines (62 loc) · 2.03 KB
/
deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Deploy
on:
workflow_run:
workflows: ["Main Build"]
types: [completed]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: false
jobs:
deploy:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- uses: actions/checkout@v3
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install AWS CDK
run: |
npm install -g aws-cdk
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@master
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }}
aws-region: ${{ vars.AWS_REGION }}
- uses: dawidd6/action-download-artifact@v2
with:
name: webapp-build
path: webapp/build
run_id: ${{ github.event.workflow_run.id }}
- uses: dawidd6/action-download-artifact@v2
with:
name: landing-page-build
path: landing-page/build
run_id: ${{ github.event.workflow_run.id }}
- name: Deploy to AWS
run: |
cd cdk
cdk diff
cdk deploy --require-approval=never
env:
AWS_ACCOUNT: ${{ secrets.AWS_ACCOUNT }}
AWS_REGION: ${{ vars.AWS_REGION }}
COGNITO_USER_POOL_ID: ${{ vars.COGNITO_USER_POOL_ID }}
COGNITO_APP_CLIENT_ID: ${{ vars.COGNITO_APP_CLIENT_ID }}
DOMAIN: ${{ vars.DOMAIN }}
SUBDOMAIN: ${{ vars.SUBDOMAIN }}
DEPLOY_LANDING_PAGE: ${{ vars.DEPLOY_LANDING_PAGE }}