Which of these happens first depends upon the star's mass.
Kumb juhtub enne sõltub tähe massist.