Narrated Jundub: The Prophet, peace be upon him, said, “He who lets the people hear of his good deeds intentionally, to win their praise, Allah will let the people know of his real intentions (on the Day of Resurrection).

And he who does good things in public to show off and win the praise of the people, Allah will disclose his real intention (and humiliate him).
[8: 506- O.B. Sahih Al-Bukhari)