Skip to content

Commit

Permalink
v1
Browse files Browse the repository at this point in the history
  • Loading branch information
eu2525 committed Nov 20, 2024
1 parent f492ad9 commit fa2fa8c
Showing 1 changed file with 8 additions and 25 deletions.
33 changes: 8 additions & 25 deletions .github/workflows/deploy_ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,16 @@ jobs:
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: dittodining
IMAGE_TAG: test
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
# - name: Deploy Amazon ECS task definition
# uses: aws-actions/amazon-ecs-deploy-task-definition@v1
# with:
# task-definition: ${{ steps.task-def.outputs.task-definition }}
# service: ecs-devops-sandbox-service
# cluster: ecs-devops-sandbox-cluster
# wait-for-service-stability: true

# - name: Update ECS service to use new image
# run: |
# ECS_CLUSTER="dittodining-production"
# ECS_SERVICE="dittodining-prod-service"
# TASK_DEFINITION=$(aws ecs describe-task-definition --task-definition dittodining:4)
# # Replace the container image with the newly pushed image
# NEW_TASK_DEFINITION=$(echo $TASK_DEFINITION | jq --arg NEW_IMAGE "${{ steps.build-image.outputs.image }}" '.taskDefinition.containerDefinitions[0].image=$NEW_IMAGE')

# # Register a new task definition with the updated image
# NEW_TASK_DEFINITION_ARN=$(echo $NEW_TASK_DEFINITION | jq -r '.taskDefinition | del(.taskDefinitionArn, .revision, .status, .requiresAttributes, .compatibilities) | . | {family: .family, containerDefinitions: .containerDefinitions} | @json' | aws ecs register-task-definition --cli-input-json file:///dev/stdin | jq -r '.taskDefinition.taskDefinitionArn')

# # Update the ECS service to use the new task definition
# aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --task-definition $NEW_TASK_DEFINITION_ARN
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ecs-devops-sandbox-service
cluster: ecs-devops-sandbox-cluster
wait-for-service-stability: true

0 comments on commit fa2fa8c

Please sign in to comment.