Skip to content

Add GitHub Actions workflow for CloudFormation deployment #12

Add GitHub Actions workflow for CloudFormation deployment

Add GitHub Actions workflow for CloudFormation deployment #12

Workflow file for this run

name: Validate and Deploy Python CDK
permissions:
id-token: write
contents: read
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install AWS CDK CLI
run: npm install -g aws-cdk
- name: Configure AWS credentials (OIDC)
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/Github
aws-region: us-east-1
- name: Set up Python virtual environment
run: python -m venv .venv
- name: Install dependencies
run: |
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
- name: CDK synth
run: |
source .venv/bin/activate
cdk synth
- name: CDK deploy
run: |
source .venv/bin/activate
cdk deploy --all --require-approval=never