Australia’s top doctor who guided the country through the Covid pandemic has announced he will be leaving his post as chief medical officer.