Skip to content

Merge pull request #12 from docwho2/dependabot/maven/software.amazon.… #49

Merge pull request #12 from docwho2/dependabot/maven/software.amazon.…

Merge pull request #12 from docwho2/dependabot/maven/software.amazon.… #49

Workflow file for this run

name: Deploy CDK Stack
on:
push:
branches: [ "main" ]
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
concurrency: deploy
jobs:
build:
strategy:
matrix:
# Deploy 2 environments, 1 to test with PBX set, one without
environment: [ frankfurt, frankfurt-pbx ]
runs-on: ubuntu-latest
environment: ${{ matrix.environment }}
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: ${{ vars.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}/${{ vars.REGION }}
- name: Destroy Stack if it exists
run: cdk destroy -c accountId=${AWS_ACCOUNT_ID} -c stackName=${{ vars.STACK_NAME }} -c regionEast=${{ vars.REGION }} --force --ci=true east
- name: Sleeping for 10 seconds
run: sleep 10
- name: Add PBX_HOSTNAME to Environment if var is set
if: ${{ vars.PBX_HOSTNAME }}
run: echo "PBX_HOSTNAME=${{ vars.PBX_HOSTNAME }}" >> $GITHUB_ENV
- name: Deploy Stack
run: |
# deploy stacks 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 deploy -c accountId=${AWS_ACCOUNT_ID} -c stackName=${{ vars.STACK_NAME }} -c regionEast=${{ vars.REGION }} --require-approval=never --ci=true east