What part of speech does publishing in the following phrase publishing a newspaper?

In the term, 'publishing a newspaper', the word publishing is acting as a verb.

They were publishing a newspaper. (main verb)

Publishing a newspaper was he dream. (verb component of noun clause as the subject of sentence)

They began their company by publishing a newspaper. (verb component of noun clause as object of the preposition 'by')

Publishing as a gerund: Publishing is the mainstay of their business.

Publishing as an adjective: He's planning to enter the publishing business.