  Axion-like particles (ALPs) may be abundantly produced in core-collapse (CC)
supernovae (SNe), hence the cumulative signal from all past SN events can
create a diffuse flux peaked at energies of about 25~MeV. We improve upon the
modeling of the ALPs flux by including a set of CC SN models with different
progenitor masses, as well as the effects of failed CC SNe -- which yield the
formation of black holes instead of explosions. Relying on the coupling
strength of ALPs to photons and the related Primakoff process, the diffuse SN
ALP flux is converted into gamma rays while traversing the magnetic field of
the Milky Way. The spatial morphology of this signal is expected to follow the
shape of the Galactic magnetic field lines. We make use of this via a
template-based analysis that utilizes 12 years of $Fermi$-LAT data in the
energy range from 50 MeV to 500 GeV. In our benchmark case of the realization
of astrophysical and cosmological parameters, we find an upper limit of
$g_{a\gamma} \lesssim 3.76\times10^{-11}\;\mathrm{GeV}^{-1}$ at 95$\%$
confidence level for $m_a \ll 10^{-11}$ eV, while we find that systematic
deviations from this benchmark scenario induce an uncertainty as large as about
a factor of two. Our result slightly improves the CAST bound, while still being
a factor of six (baseline scenario) weaker than the SN1987A gamma-ray burst
limit.
