It is narrated from Imam Sadeq (AS) who said:
A person, who covertly carries out a good deed, will be rewarded for that deed. But if that person talks about that deed, then the reward for the covert deed disappears. And if talks about it again, that deed will be destroyed, and pretence will be written for it [1]. In another narration, Imam Baqir (AS) was asked: How to make good deeds last? Imam (AS) replied: A person gives something in the way of Allah (SWT), and rewards for that covert deed will be written for such a person; then talks about that good deed and the reward for that deed will be written as overt deed. That person talks again about that good deed until it disappears and pretence will be written for that person [2]. Imam Ali (AS) also said: To protect a good deed is more difficult that carrying out that deed [3].
[1] Beharul Anwaar, Vol. 72, Page 324.
[2] As Above, Page 292.
[3] Beharul Anwaar, Vol. 77, Page 288.
Source: en.shafaqna.com