Both the valve cover and heat shield are extremely unforgiving to paint. The valve cover is very porous and traps a LOT of oil, the only way to correctly paint it is to bake the thing for a good long while and then bead blast it. Otherwise it's just a matter of time before the paint comes off, and ends up in your engine the next time you remove it.
The heat shield has less of an oil concern, but more of a heat concern. Very few paints will take the kind of heat it is exposed to. You can address that somewhat by using a good thermal barrier under the shield.
The best way to go about it, though, is to plate or powdercoat both pieces. Considerably more expensive given the prep involved, but the finish will last longer than the car.