GitHub OIDC CDK deploy #11
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
# GitHub action that assumes a GitHub OIDC role to deploy a CDK stack in AWS | |
name: Deploy CDK Stack | |
on: | |
push: | |
branches: | |
- cdk | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
actions: write | |
contents: read | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
cache-dependency-path: test-app | |
- name: Install CDK | |
run: npm install -g aws-cdk | |
- name: Install dependencies | |
working-directory: test-app | |
run: npm install | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: ap-southeast-2 | |
role-to-assume: arn:aws:iam::854640616043:role/GitHubStack-datamanagementapplicationgithubdeployr-1K1VJXTWT2BH8 | |
role-duration-seconds: 900 | |
output-credentials: true | |
- name: Deploy CDK Stack | |
working-directory: test-app | |
run: cdk deploy TestAppStack |