From cb7940036f2c58d5d742a99e5897d3159b006aaa Mon Sep 17 00:00:00 2001 From: Abel Ratanaphan Date: Thu, 22 Aug 2024 10:36:08 -0400 Subject: [PATCH] fix: test workflow --- .github/workflows/aws.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/aws.yml b/.github/workflows/aws.yml index 23395bf..108be56 100644 --- a/.github/workflows/aws.yml +++ b/.github/workflows/aws.yml @@ -51,6 +51,19 @@ jobs: docker buildx build --platform linux/amd64 --push -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT + - name: Fetch Latest Task Definition ARN + id: fetch-task-def-arn + run: | + # Fetch the latest task definition for the service + TASK_DEFINITION_ARN=$(aws ecs describe-services \ + --cluster ${{ env.ECS_CLUSTER }} \ + --services ${{ env.ECS_SERVICE }} \ + --query 'services[0].taskDefinition' \ + --output text) + + echo "TASK_DEFINITION_ARN=$TASK_DEFINITION_ARN" >> $GITHUB_ENV + - name: Deploy to AWS ECS run: | - aws ecs update-service --cluster ${{ env.ECS_CLUSTER }} --service ${{ env.ECS_SERVICE }} --force-new-deployment + # Use the latest task definition revision for the deployment + aws ecs update-service --cluster ${{ env.ECS_CLUSTER }} --service ${{ env.ECS_SERVICE }} --task-definition ${{ env.TASK_DEFINITION_ARN }} --force-new-deployment