  We calculate spectra of escaping cosmic rays (CRs) accelerated at shocks
produced by expanding Galactic superbubbles powered by multiple supernovae
producing a continuous energy outflow in star-forming galaxies. We solve the
generalized Kompaneets equations adapted to expansion in various external
density profiles, including exponential and power-law shapes, and take into
account that escaping CRs are dominated by those around their maximum energies.
We find that the escaping CR spectrum largely depends on the specific density
profiles and power source properties, and the results are compared to and
constrained by the observed CR spectrum. As a generic demonstration, we apply
the scheme to a superbubble occurring in the centre of the Milky Way, and find
that under specific parameter sets the CRs produced in our model can explain
the observed CR flux and spectrum around the second knee at $10^{17}$ eV.
