The mayor of a city in southern Ukraine has described its inhabitants as “heroes” and has pledged the city will emerge from the full-scale invasion of his country as a model for other urban areas devastated by the war, even as residents cope with an overnight attack on Thursday.