Skip to content

Deploy

Deploy #9

Workflow file for this run

name: Deploy
on:
workflow_call:
inputs:
env:
type: string
required: true
account_id:
type: string
required: true
stacks:
type: string
default: "**"
workflow_dispatch:
inputs:
env:
type: choice
options:
- Dev
- Test
- Prod
description: Target environment
required: true
account_id:
type: string
description: Target AWS account
required: true
stacks:
type: string
description: Stacks to deploy
default: "**"
concurrency: deploy-${{ github.ref_name }}-${{ inputs.env }}
jobs:
run:
name: ${{ github.ref_name == 'main' && 'Deploy' || 'Diff' }} to ${{ inputs.env }} (${{ inputs.account_id }})
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
env:
TAG: ${{ github.sha }}
steps:
- uses: actions/checkout@v4
- name: Install tools
uses: jdx/mise-action@v2
with:
experimental: true
- name: Log in to ${{ inputs.env }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-1
role-to-assume: arn:aws:iam::${{ inputs.account_id }}:role/kitu-github-actions-role
- name: Install dependencies
run: npm ci
working-directory: infra
- name: Deploy
if: github.ref_name == 'main'
run: npx cdk deploy --require-approval=never --exclusively '${{ inputs.env }}/${{ inputs.stacks }}'
working-directory: infra
- name: Diff
if: github.ref_name != 'main'
run: npx cdk diff --require-approval=never --exclusively '${{ inputs.env }}/${{ inputs.stacks }}'
working-directory: infra