I injured my upper trap lifting weights. What should I do for it?

Rest, ice, etc. . Rest from offending activities, ice the area 3-5x/day x 20 minutes and consider Ibuprofen or Naproxen for a few days. Gentle massage may be of benefit. Muscular pain usually resolves within a week. See a doc if pain persists beyond this.
Rest. Alternate heat and ice, rest with no lifting involving this muscle for 1-2 weeks then reduce your exercise program to half what you were doing before you injured the muscle and gradually increase the weight to prevent new injury.