A pastor's main job is to preach in church.

Literal

Pastor [attributive-の] main [attributive-な] job [topic-は] church [at-で] preach [nominalizer-こと] [is-です].

主な ('main, principal') is an attributive form of the noun/stem 主. 説教する ('to preach, give a sermon') is used both literally (religious sermon) and figuratively (lecture someone, scold). こと nominalizes the preaching clause into a noun for use as the predicate.