Add GitHub Actions workflow for CloudFormation deployment #12
This file contains hidden or 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: 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 |