Merge pull request #28 from BjornMelin/dev #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Infrastructure | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "infrastructure/**" | |
workflow_dispatch: | |
env: | |
AWS_REGION: us-east-1 | |
jobs: | |
deploy-infrastructure: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
cache: "yarn" | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
# Install CDK dependencies | |
- name: Install CDK Dependencies | |
working-directory: infrastructure | |
run: yarn install --frozen-lockfile | |
# Deploy stacks in order | |
- name: Deploy DNS Stack | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
working-directory: infrastructure | |
run: yarn cdk deploy prod-portfolio-dns --require-approval never | |
- name: Deploy Storage Stack | |
working-directory: infrastructure | |
run: yarn cdk deploy prod-portfolio-storage --require-approval never | |
- name: Deploy Email Stack | |
working-directory: infrastructure | |
run: yarn cdk deploy prod-portfolio-email --require-approval never | |
- name: Deploy Monitoring Stack | |
working-directory: infrastructure | |
run: yarn cdk deploy prod-portfolio-monitoring --require-approval never |