WF switch to use actual cdk synth operation #43
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 Stack | |
on: | |
push: | |
branches: [ "main" ] | |
env: | |
# Region to deploy | |
REGION: eu-central-1 | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
concurrency: deploy | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
cache: maven | |
- name: Install AWS CDK | |
run: | | |
# Install latest version of AWS CDK | |
npm install -g aws-cdk | |
echo "Node Version: $(node -v)" | |
echo "CDK Version: $(cdk version)" | |
- name: Setup AWS Credentials | |
id: aws-creds | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: ${{ env.REGION }} | |
# The full role ARN if you are using OIDC | |
# https://github.com/aws-actions/configure-aws-credentials#oidc | |
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | |
# Set up the below secrets if you are not using OIDC and want to use regular keys (best practive is to use just role above with OIDC provider) | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
mask-aws-account-id: true | |
- name: Add AWS_ACCOUNT_ID to Environment | |
run: echo "AWS_ACCOUNT_ID=${{ steps.aws-creds.outputs.aws-account-id }}" >> $GITHUB_ENV | |
- name: Ensure CDK is bootstraped and up to date | |
run: | | |
cdk bootstrap --ci=true -c accountId=${AWS_ACCOUNT_ID} aws://${AWS_ACCOUNT_ID}/${REGION} | |
- name: Deploy Stack with PBX_HOSTNAME | |
run: | | |
# deploy a stack to Frankfurt to validate everything (just to keep us-east-1 and us-west-2 cleaner) | |
# Also you are limited to 3 Voice Connectors per region | |
cdk destroy -c accountId=${AWS_ACCOUNT_ID} -c stackName=chime-cdk-gh-wf-pbx -c regionEast=${REGION} --force --ci=true east | |
cdk deploy -c accountId=${AWS_ACCOUNT_ID} -c stackName=chime-cdk-gh-wf-pbx -c regionEast=${REGION} --require-approval=never --ci=true east | |
env: | |
# Set this to bogus IP (cannot be private IP) just so VoiceConnector Origination settings are deployed to validate that works | |
PBX_HOSTNAME: 54.0.0.1 | |
- name: Deploy Stack without PBX_HOSTNAME | |
run: | | |
# deploy a stack to Frankfurt to validate everything (just to keep us-east-1 and us-west-2 cleaner) | |
# Also you are limited to 3 Voice Connectors per region | |
cdk destroy -c accountId=${AWS_ACCOUNT_ID} -c stackName=chime-cdk-gh-wf-nopbx -c regionEast=${REGION} --force --ci=true east | |
cdk deploy -c accountId=${AWS_ACCOUNT_ID} -c stackName=chime-cdk-gh-wf-nopbx -c regionEast=${REGION} --require-approval=never --ci=true east |