From cdd0eb4d826f33044f8afb1f7179030a47b0ed93 Mon Sep 17 00:00:00 2001 From: wspooong Date: Thu, 28 Mar 2024 00:04:22 +0800 Subject: [PATCH] Update for force update ECS service. --- .github/workflows/aws.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/aws.yml b/.github/workflows/aws.yml index 5061b2b..af0cf57 100644 --- a/.github/workflows/aws.yml +++ b/.github/workflows/aws.yml @@ -25,13 +25,6 @@ jobs: with: envkey_VITE_API_URL: ${{ secrets.VITE_API_URL }} - # - name: Get current time - # uses: josStorer/get-current-time@v2.0.2 - # id: current-time - # with: - # format: YYYYMMDD-HHmmSS - # utcOffset: "+08:00" - - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: @@ -47,7 +40,6 @@ jobs: id: build-image env: ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - # IMAGE_TAG: ${{ steps.current-time.outputs.formattedTime }} IMAGE_TAG: production run: | # Build a docker container and @@ -56,3 +48,12 @@ jobs: docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT + + - name: Update ECS service + id: update-ecs-service + run: | + aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} + aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws configure set default.region ${{ secrets.AWS_REGION }} + aws ecs update-service --cluster ${{ secrets.ECS_CLUSTER }} --service ${{ secrets.ECS_SERVICE_NAME }} --force-new-deployment + \ No newline at end of file