Skip to content

Commit

Permalink
Rework cicd pipeline to support dev & prod (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
alukach authored Jan 23, 2025
1 parent 702d942 commit a145314
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 14 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CICD

on:
push:
branches:
- main
release:
types:
- created

jobs:
deploy-dev:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: ./.github/workflows/deploy.yaml
with:
environment: dev

deploy-prod:
if: github.event_name == 'release'
uses: ./.github/workflows/deploy.yaml
with:
environment: prod
29 changes: 15 additions & 14 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
name: Deploy CDK
name: 🚀 Deploy & Configure Service

on:
push:
branches:
- main
workflow_dispatch:
workflow_call:
inputs:
environment:
required: true
description: "Environment to deploy to"
type: string

permissions:
id-token: write
contents: read
concurrency:
group: ${{ inputs.environment }}
cancel-in-progress: false

run-name: Deploy to ${{ inputs.environment }} environment by @${{ github.actor }}

jobs:
deploy:
runs-on: ubuntu-latest
environment: dev
concurrency:
group: dev_env
cancel-in-progress: false
environment: ${{ inputs.environment }}

steps:
- name: Checkout the repository
Expand Down Expand Up @@ -51,15 +52,15 @@ jobs:
KEYCLOAK_VERSION: ${{ vars.KEYCLOAK_VERSION }}
KEYCLOAK_CONFIG_CLI_VERSION: ${{ vars.KEYCLOAK_CONFIG_CLI_VERSION }}
SSL_CERTIFICATE_ARN: ${{ vars.SSL_CERTIFICATE_ARN }}
STAGE: ${{ vars.STAGE }}
STAGE: ${{ inputs.environment }}
# Imported Identity Provider secrets
IDP_SECRET_ARN_GH: ${{ vars.IDP_SECRET_ARN_GH }}
IDP_SECRET_ARN_CILOGON: ${{ vars.IDP_SECRET_ARN_CILOGON }}

- name: Get ConfigLambdaArn from CloudFormation
id: get-lambda-arn
run: |
echo "CONFIG_LAMBDA_ARN=$(jq -r '."veda-keycloak-${{ vars.STAGE }}".ConfigLambdaArn' outputs.json)" >> $GITHUB_ENV
echo "CONFIG_LAMBDA_ARN=$(jq -r '."veda-keycloak-${{ inputs.environment }}".ConfigLambdaArn' outputs.json)" >> $GITHUB_ENV
- name: Run Apply Config
run: npm run apply-config $CONFIG_LAMBDA_ARN

0 comments on commit a145314

Please sign in to comment.