Roof molding loose due to internal wood rot 1923 Hudson

While replacing the headliner I found some wood in the top corner to be dry rotted. When removing it I found the nails from the outside bead that must waterproof the two pieces of aluminum exposed as they were nailed into this piece of wood. My plan is to use epoxy around the nails to reset the outside bead as I pull down on each nail. Then caulk the joint.  Will epoxy bond with the aluminum or should I use something else or do something different. Looking for help from someone who has been here before.
Robert