I have a player in my campaign who took the Flames of Phlegethos tiefling racial feat (from Xanathar's Guide to Everything, p. 74-75). One of its benefits is:
Whenever you cast a spell that deals fire damage, you can cause flames to wreathe you until the end of your next turn. The flames don’t harm you or your possessions, and they shed bright light out to 30 feet and dim light for an additional 30 feet. While the flames are present, any creature within 5 feet of you that hits you with a melee attack takes 1d4 fire damage.
Additionally, he took the produce flame cantrip:
A flickering flame appears in your hand. The flame remains there for the duration [...]
You can also attack with the flame. When you cast this spell, or as an action on a later turn, you can hurl the flame at a creature within 30 feet of you. Make a ranged spell attack. On a hit, the target takes 1d8 fire damage.
If he casts the produce flame cantrip and holds it (i.e. doesn't attack or attempt to deal damage with it), would that still trigger this benefit of the Flames of Phlegethos feat?