You should sell your home first. there are too many repercussions with buying something before selling. Having already sold your home gives you the money and thus more leverage to negotiate with if you find yourself in competition for your next home.
However there are steps to be taken when selling first:
Extend your closing.
Have a backup housing plan in place.