Skip to content

Deploy

Deploy #12

Workflow file for this run

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@v6
with:
name: webapp-build
path: webapp/build
run_id: ${{ github.event.workflow_run.id }}
- uses: dawidd6/action-download-artifact@v6
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 }}