Iran and Israel continued to attack one another in the hours before a ceasefire announced by US President Donald Trump.