There are a few ways to roast coffee, commercially in big roasters, small roaster in coffee shops, and some people like to do it at home on a smaller scale.
This will go over the basics of roasting the beans.
The green beans go into a roaster where they will begin to heat up to around 175c. Depending on the roaster and the intensity of the roast itself the heat will change a bit.
The beans start to turn yellow and smell grassy. Then they will begin to emit steam as it releases CO2 gasses.
Next is the first crack. It is an audible cracking noise. This is the lightest roast.
As they continue to heat up and darken they will produce other roasts on the spectrum. There will be a second crack as the roast goes from medium to dark.
Roasters have to be careful, after 238c, the roast starts to taste burned. After 250C the roast would be considered burned as almost all of the natural sugars have caramelized and burned away.
The beans go through an order of roasting stages: