The Scottish government has been ordered to publish some of the written evidence from an investigation into whether Nicola Sturgeon broke the ministerial code.