Search for high-mass Z$\gamma$ resonances in $\mathrm e ^+\mathrm e ^-\gamma $ and $ μ^+μ^-\gamma$ final states in proton-proton collisions at $\sqrts =$ 8 and 13 TeV