  The cosmic thermal history, quantified by the evolution of the mean thermal
energy density in the universe, is driven by the growth of structures as
baryons get shock heated in collapsing dark matter halos. This process can be
probed by redshift-dependent amplitudes of the thermal Sunyaev-Zeldovich (SZ)
effect background. To do so, we cross-correlate eight sky intensity maps in the
$\it{Planck}$ and Infrared Astronomical Satellite missions with two million
spectroscopic redshift references in the Sloan Digital Sky Surveys. This
delivers snapshot spectra for the far-infrared to microwave background light as
a function of redshift up to $z\sim3$. We decompose them into the SZ and
thermal dust components. Our SZ measurements directly constrain $\langle
bP_{\rm e} \rangle$, the halo bias-weighted mean electron pressure, up to
$z\sim 1$. This is the highest redshift achieved to date, with uncorrelated
redshift bins thanks to the spectroscopic references. We detect a threefold
increase in the density-weighted mean electron temperature $\bar{T}_{\rm{e}}$
from $7\times 10^5~{\rm K}$ at $z=1$ to $2\times 10^6~{\rm K}$ today. Over
$z=1$-$0$, we witness the build-up of nearly $70\%$ of the present-day mean
thermal energy density $\rho_{\rm{th}}$, with the corresponding density
parameter $\Omega_{\rm th}$ reaching $1.5 \times10^{-8}$. We find the mass bias
parameter of $\it{Planck}$'s universal pressure profile of $B=1.27$ (or
$1-b=1/B=0.79$), consistent with the magnitude of non-thermal pressure in gas
motion and turbulence from mass assembly. We estimate the redshift-integrated
mean Compton parameter $y\sim1.2\times10^{-6}$, which will be tested by future
spectral distortion experiments. More than half of which originates from the
large-scale structure at $z<1$, which we detect directly.
