DRONE_TAG env variable not working

I want to create a docker image every time a tag is added using the git tag as the image tag using drone CI. I’ve created the .drone.yml file with this pipeline:

kind: pipeline
type: docker
name: tag

    - name: docker_tag
      image: plugins/docker
      settings:
          username:
              from_secret: docker_hub_username
          password:
              from_secret: docker_hub_token
          tags: ${DRONE_TAG}
          repo: foo/bar
          dockerfile: Dockerfile


trigger:
    event:
        - tag

But then ${DRONE_TAG} evaluates to nothing and it says that its not a correct tag name:
Error parsing reference: "foo/bar:" is not a valid repository/tag: invalid reference format

How can I make this work?

@joelimgu were you able to get through this issue? Sharing some links for your reference

  1. Using custom generated tags for Docker images - Drone
  2. Running git tag after each build - Development - Drone

Thanks!