Branch or tag version as tag name for aws-ecr orb

Hello, I try to setup custom tag for specific branch/tag. I want to push to ECR only when branch is staging or tag.
In general it should works like this one

workflows:
  version: 2
  backend:
    jobs:
      - aws-ecr/build-and-push-image:
          pre-steps:
            - run:
                name: Setup Docker Image Tag
                command: |
                  if [ $CIRCLE_TAG ]; then
                    ENV=production
                  elif [ "$CIRCLE_BRANCH" = "staging" ]; then
                    ENV=staging
                  fi
          repo: "${AWS_RESOURCE_NAME_PREFIX}"
          tag: "$ENV"

          filters:
            branches:
              only: staging
            tags:
              only:
                - /^v\d+\.\d+\.\d+$/

But it doesn’t work for me. Where I’m wrong?

Can you be more specific about what is going wrong? You’ve given us very little to work with.

Off the top of my head, you need to be using version 2.1 (you’re using 2) to use pre-steps: Configuring CircleCI - CircleCI