Cosmological scenarios involving a cosmological phase transitions have gained popularity over recent years, in particular because of their gravitational wave signatures. I will discuss how such phase transitions affect leptogenesis using sterile right-handed neutrinos. We will consider that the sterile neutrinos obtain a Majorana mass thanks to the cosmological phase transition of a BSM scalar field. This leads to interesting nonequilibrium dynamics during the transition, as well as different mechanisms of lepton asymmetry production in the cosmological evolution of the particles. Using nonequilibrium QFT, I will describe the relevant equations, and show how they can be solved (numerically and analytically) and what they tell us about the effect of a phase transition on leptogenesis.