Wiktionary
do well by doing good
vb. (context idiomatic English) To achieve social acceptance or financial success as a result of behaving in a benevolent or charitable manner.