Center-vortex solutions of the Yang-Mills effective action in three and four dimensions