Sorry that happened to you, it sounds like a really unfortunate situation. This is cliche, but the more that you dwell on it the longer you stay miserable. She is a really big asshole and nobody deserves that type of treatment, and I think people would unanimously agree on that, so you shouldn't feel responsible for her actions and think you did something wrong or could've done things differently. Her entering the relationship makes her contracted to honesty and transparency, and especially when it comes to something so big like a pregnancy that's yours. I mean, people cheat because they are assholes, and because they have no consideration for who they hurt. I don't think speculating on it and justifying otherwise is going to help, because you can't mind read others and in most cases it really is that simple. You didn't deserve that, but you happened to stumble on a terrible human being.
I think part of healing involves coming to terms that even if she hadn't made that decision specifically, that she still wouldn't have been a good partner because she's okay with dishonesty. That you got out of something that wasn't great and that while the relationship was misfortunate, perhaps the break up was not and you're out now, though with wounds from it.