GitHub action flow to deploy a multi-env CDK app
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 CDK Project | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
jobs: | |
aws_cdk: | |
if: github.event.pull_request.merged == true || github.event_name == 'push' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '18' | |
- run: npm install | |
- name: cdk diff | |
uses: youyo/aws-cdk-github-actions@v2 | |
with: | |
cdk_subcommand: 'diff' | |
actions_comment: true | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: cdk deploy | |
uses: youyo/aws-cdk-github-actions@v2 | |
with: | |
cdk_subcommand: 'deploy' | |
cdk_stack: '*' | |
cdk_args: '--require-approval never' | |
actions_comment: false | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment