From d7ee147cff487c0e88b646424b807f1f11d20f4f Mon Sep 17 00:00:00 2001 From: Anthony Lukach Date: Thu, 17 Oct 2024 11:48:50 -0700 Subject: [PATCH] feat: add github workflow --- .github/workflows/deploy.yaml | 48 +++++++++++++++++++++++++++++++++++ cdk.json | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..f29ba1b --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,48 @@ +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_REGION: ${{ vars.AWS_REGION }} + AWS_ACCOUNT_ID: ${{ vars.AWS_ACCOUNT_ID }} + SSL_CERTIFICATE_ARN: ${{ vars.SSL_CERTIFICATE_ARN }} + HOSTNAME: ${{ vars.SSL_CERTIFICATE_ARN }} + STAGE: ${{ vars.STAGE }} + KEYCLOAK_VERSION: ${{ vars.KEYCLOAK_VERSION }} diff --git a/cdk.json b/cdk.json index aeb98c2..0a8c18f 100644 --- a/cdk.json +++ b/cdk.json @@ -1,5 +1,5 @@ { - "app": "npx ts-node --prefer-ts-exts deploy/veda-keycloak.ts", + "app": "npx ts-node --prefer-ts-exts deploy/app.ts", "watch": { "include": ["**"], "exclude": [