diff --git a/.github/workflows/aws_deploy.yml b/.github/workflows/aws_deploy.yml index f8005d9e8..0ca309c5e 100644 --- a/.github/workflows/aws_deploy.yml +++ b/.github/workflows/aws_deploy.yml @@ -49,16 +49,14 @@ jobs: with: mask-password: 'true' - - name: Check if image with tag already exists (hide errors?) - run: | - aws ecr describe-images --repository-name=$repository --image-ids=imageTag=${{ github.sha }} 2> /dev/null - - name: Check if image with tag already exists + id: check-image-exists run: | - aws ecr describe-images --repository-name=$repository --image-ids=imageTag=${{ github.sha }} + echo "image-exists=$(if aws ecr list-images --no-paginate --repository-name=$repository --query "imageIds[*].imageTag" | grep -q ${{ github.sha }}; then echo true; else echo false; fi)" >> $GITHUB_ENV - name: Build, tag, and push docker image to ECR id: build-image + if: ${{ ! env.image-exists }} env: registry: ${{ steps.ecr-login.outputs.registry }} commit_tag: ${{ github.sha }}