I don't know what the next steps are

So first of all I'm an idiot. And I know this. So if that's what you're planning on saying please don't bother because I get it.

I was in a very unhealthy relationship from September until the 2nd week of January. In that short time he cheated on me twice and I took him back both times. I'm not perfect so don't just assume I'm the victim. I have the tendency to be very quiet and distant because of something in my past. And he was aware yet still wanted to be a couple. Anyways sometimes if I was a little quiet or needed some space, instead of asking if I was okay he'd scream at me and beat me. Granted I know I can be distant but it's really just because of something that took place in my past that has forever scarred me. Also he was never really the most encouraging guy. But I stuck it out for a little while longer.

So I started dating this new guy beginning of February. He seems very nice and into me. He's got 2 kids from a previous relationship and that's ok with me.

We've already slept together and he's even mentioned/ brought up the idea of moving in together around summer time (take it slow, no pressure)

I have irregular periods so I never gave it much thought when it didn't show up when expected. And I figured Oh if I am pregnant it's gotta be my boyfriends baby.

I went to the doctor to find out that I'm 8 weeks which puts my ex as the father.

So I'm panicking thinking I've screwed up having a baby with a not so great guy. And I went to my boyfriend just bawling, apologizing for not being good enough and called off the relationship. He literally took both my hands and said I'm not leaving you, I'll treat this baby like my own. So now I'm overwhelmed that he's willing to stay. I'm happy. That never happens. There aren't many guys who want to stay with a girl who is pregnant by another man. But he said he's not going anywhere and said he loves me.

So now we're talking about how to tell my ex because he's not in the country right now as per his mom. How do I tell him (once he comes back)