diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a19b17a..9c4e2a3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -73,9 +73,21 @@ jobs : image: ${{ steps.login-ecr.outputs.registry }}/${{ github.event.repository.name }}:${{ github.sha }} - name: Deploy Amazon ECS task definition + id: ecs-deploy uses: aws-actions/amazon-ecs-deploy-task-definition@v1 with: task-definition: ${{ steps.task-def.outputs.task-definition }} service: ${{ inputs.service-name }} cluster: ${{ inputs.cluster-prefix }}-${{ inputs.environment }} wait-for-service-stability: true + + - name: Verify ECS deployment + run: | + CURRENT_TASK_DEF_ARN=$(aws ecs describe-services --cluster ${{ inputs.cluster-prefix }}-${{ inputs.environment }} --service ${{ inputs.service-name }} --query services[0].deployments[0].taskDefinition | jq -r ".") + NEW_TASK_DEF_ARN=${{ steps.ecs-deploy.outputs.task-definition-arn }} + echo "Current task arn: $CURRENT_TASK_DEF_ARN" + echo "New task arn: $NEW_TASK_DEF_ARN" + if [ "$CURRENT_TASK_DEF_ARN" != "$NEW_TASK_DEF_ARN" ]; then + echo "Deployment failed." + exit 1 + fi