I wonder which case the gerund or infinitive is (more) appropriate here: "I did my best to do something" or "I did my best doing something"?
Your first example is idiomatic.
I did my best to do this. ... It means “I tried as hard as I could to accomplish this”—regardless of whether you actually did accomplish it.
Your second example is not idiomatic, but it is very close to a different idiom.
I did my best in doing this. ... It means “This was the best work I had ever done”—you achieved a new level of excellence.