First you have to know what you want the expected outcome to be. Is it just to tell them to relieve a burden internally? Do you want to try throupling? Do you want to start transitioning and remain married?
Second, don’t assume how your spouse feels. Many times we are creatures of habit and simply react how we have seen others react. There is no rule book for how love works. If you still love your spouse but have same sex attractions, there’s no rule that states divorce must follow. That decision is you and your partners alone.
Third, tell them privately. Don’t throw a party and tell them in front of a bunch of people. When you tell them, expect questions like “Now what?” This is where the expectation of your ideal outcome comes into play, let them know what you want.
There is so much to consider and no cookie cutter answers. Perhaps the most important aspect of this is sensitivity to you AND your partners feelings.
Whatever it is you decide, be nice and do it with care.