The growth of mass in star-forming galaxies at high redshift