Skip to content

Commit

Permalink
created new revision for task definition
Browse files Browse the repository at this point in the history
  • Loading branch information
Priyanka-Inflectionzone committed Feb 2, 2024
1 parent f57f7f7 commit 2ebf06b
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions .github/workflows/deploy-ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,27 @@ jobs:
run: |
aws ecs describe-task-definition --task-definition reancare-service:${{ steps.get-latest-revision.outputs.revision }} \
--query taskDefinition > task-definition.json
cat task-definition.json
- name: 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: reancare-container
image: 443751504066.dkr.ecr.ap-south-1.amazonaws.com/reancare:${{ github.sha }}
revision: ${{ steps.get-latest-revision.outputs.revision }}
- name: Update container image in task definition
run: |
jq '.containerDefinitions[0].image="443751504066.dkr.ecr.ap-south-1.amazonaws.com/reancare:${GITHUB_SHA}"' task-definition.json > new-task-definition.json
# - name: 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: reancare-container
# image: 443751504066.dkr.ecr.ap-south-1.amazonaws.com/reancare:${{ github.sha }}

- name: Create a new revision of ECS task definition
id: create-new-revision
run: |
new_revision=$(aws ecs register-task-definition --cli-input-json file://new-task-definition.json --query 'taskDefinition.revision' --output text)
echo "New revision created: $new_revision"
echo "::set-output name=new-revision::$new_revision"
- name: Task Definition Variable
id: taskdefintionvar
Expand All @@ -70,4 +82,4 @@ jobs:
- name: Deploy to ECS
run: |
aws ecs update-service --cluster reancare-cluster --service rean-backend --task-definition reancare-service:${{ steps.get-latest-revision.outputs.revision }} --force-new-deployment
aws ecs update-service --cluster reancare-cluster --service rean-backend --task-definition reancare-service:${{ steps.create-new-revision.outputs.new-revision }} --force-new-deployment

0 comments on commit 2ebf06b

Please sign in to comment.