It should be applied along the span, as distributed load.
However, if your software is incapable of accepting such load, you may opt to apply equivalent moments at both ends. Make sure that the beam is free to rotate at the supports in the vertical plane.
Other method is to put separate element on the top of your beam, provide connectors (short and stiff beams) and then apply temperature load to the artificial element on the top. This will be the most accurate method, as most of the moment will be acting on the beam only.