The Messenger of Allah ﷺ said, "Whoever does a deed to be heard of, Allah will expose him, and whoever does a deed to be seen, Allah will expose him."
قال رسول الله ﷺ: من سمع سمع الله به، ومن راعي راءى الله به.
No references are available.
Muslim narrated it in Zuhd (2986) from Umar bin Hafs bin Ghiyath, who said, my father told me, from Ismail bin Sumay, from Muslim Al-Batin, from Saeed bin Jubayr, from Ibn Abbas, who said, and then he mentioned it.