Skip to content

Commit

Permalink
fix: test if task def works
Browse files Browse the repository at this point in the history
  • Loading branch information
abelr20 committed Aug 22, 2024
1 parent 585b859 commit b2b9796
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
- name: Login to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Build and push new Docker image to Amazon ECR
- name: Build and push new Docker image to AWS ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
Expand All @@ -56,32 +56,29 @@ 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: Register ECS task definition
- name: Register ECS Task definition
id: register-task-def
run: |
# Enable error handling
set -e
set -o pipefail
# 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)
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
- name: Deploy to AWS ECS
run: |
# Enable error handling
set -e
set -o pipefail
# Use the latest task definition ARN
# 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
# Wait until the service has stabilized
aws ecs wait services-stable \
--cluster ${{ env.ECS_CLUSTER }} \
--services ${{ env.ECS_SERVICE }}

0 comments on commit b2b9796

Please sign in to comment.