Skip to content

feat: add test endpoint #12

feat: add test endpoint

feat: add test endpoint #12

name: (Develop) Deploy Chats
on:
push:
branches:
- main
paths:
- containers/chats/**
workflow_dispatch:
permissions:
id-token: write
contents: read
env:
ECS_CLUSTER: main
ECS_SERVICE: chat
ECS_TASK_DEFINITION: chat
ECR_REPOSITORY: chat
CONTAINER_NAME: chat
jobs:
deployment:
name: Deployment
runs-on: ubuntu-latest
environment: develop
defaults:
run:
working-directory: ./containers/chats
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ vars.AWS_GITHUB_ROLE }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build, tag, and push image to Amazon ECR
id: build-image
uses: docker/build-push-action@v5
with:
push: true
context: ./containers/chats
tags: |
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ github.sha }}
${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:latest
platforms: linux/arm64
- name: Download task definition
run: |
aws ecs describe-task-definition \
--task-definition $ECS_TASK_DEFINITION \
--query taskDefinition \
--region ${{ vars.AWS_REGION }} > ../../task-definition.json
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: ${{ env.CONTAINER_NAME }}
image: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ github.sha }}
- name: Deploy to ECS
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
task-definition: ${{ steps.task-def.outputs.task-definition }}
wait-for-service-stability: true