Skip to content

Commit

Permalink
fix: ensure new task def revision is used when redeploying
Browse files Browse the repository at this point in the history
  • Loading branch information
abelr20 committed Aug 22, 2024
1 parent effcc29 commit 91a2a1b
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,28 @@ jobs:
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Register ECS Task Definition
id: register-task-def
run: |
# Enable error handling
set -e
set -o pipefail
# Register the task definition with ECS
aws ecs register-task-definition \
--cli-input-json file://$ECS_TASK_DEFINITION
# Register the task definition with ECS and capture the revision number
TASK_DEFINITION_ARN=$(aws ecs register-task-definition \
--cli-input-json file://$ECS_TASK_DEFINITION \
--query 'taskDefinition.taskDefinitionArn' --output text)
echo "TASK_DEFINITION_ARN=$TASK_DEFINITION_ARN" >> $GITHUB_ENV
- name: Deploy to Amazon ECS
run: |
# Enable error handling
set -e
set -o pipefail
# Update the ECS service
aws ecs update-service --cluster ${{ env.ECS_CLUSTER }} --service ${{ env.ECS_SERVICE }} --force-new-deployment
# Update the ECS service to use the latest task definition revision
aws ecs update-service \
--cluster ${{ env.ECS_CLUSTER }} \
--service ${{ env.ECS_SERVICE }} \
--task-definition ${{ env.TASK_DEFINITION_ARN }} \
--force-new-deployment

0 comments on commit 91a2a1b

Please sign in to comment.