Mv config task execution to GH Actions #16
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 | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: dev | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ vars.AWS_CDK_DEPLOY_ROLE_ARN }} | |
aws-region: ${{ vars.AWS_REGION }} | |
role-session-name: GitHubActionsCDKDeploy | |
role-duration-seconds: 900 # Adjust as necessary | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 # Use the node version matching your project | |
- name: Install dependencies | |
run: | | |
npm install -g aws-cdk | |
npm ci # Install project dependencies from package-lock.json | |
- name: Deploy CDK to dev environment | |
run: | | |
cdk deploy --require-approval never | |
env: | |
AWS_ACCOUNT_ID: ${{ vars.AWS_ACCOUNT_ID }} | |
AWS_REGION: ${{ vars.AWS_REGION }} | |
GH_OAUTH_CLIENT_SECRET: ${{ vars.GH_OAUTH_CLIENT_SECRET }} | |
HOSTNAME: ${{ vars.HOSTNAME }} | |
KEYCLOAK_VERSION: ${{ vars.KEYCLOAK_VERSION }} | |
SSL_CERTIFICATE_ARN: ${{ vars.SSL_CERTIFICATE_ARN }} | |
STAGE: ${{ vars.STAGE }} | |
- name: Get ConfigLambdaArn from CloudFormation | |
id: get_lambda_arn | |
run: | | |
STACK_NAME="your-stack-name" | |
ARN=$(aws cloudformation describe-stacks \ | |
--stack-name "$STACK_NAME" \ | |
--query "Stacks[0].Outputs[?OutputKey=='ConfigLambdaArn'].OutputValue" \ | |
--output text) | |
echo "::set-output name=ConfigLambdaArn::$ARN" | |
- name: Run Apply Config | |
run: npm run apply-config "${{ steps.get_lambda_arn.outputs.ConfigLambdaArn }}" |