Can I get branch name when tag pushed?

Can I get branch name on tagging?

In release, I use tags. but I don’t want to tag to only main branch.
In .gitlab-ci.yml, I wrote this, but $CI_COMMIT_BRANCH is empty.

.release:
  rules:
    - if: $CI_COMMIT_BRANCH == "main" && $CI_COMMIT_TAG =~ /^\d+\.\d+\.\d/