Blender 2.8 Baking lightmaps

Lightmaps are a cheap way to add a lot of realism to you static scenes and have been used forever. They are still common in real-time architectural visualisations. In short, they cache light calculations which otherwise take a lot of time to calculate.

After experimenting a bit I figured out a way to bake light maps in Blender 2.8. There was a standard addon in 2.79 which is currently not part of 2.8 and I'm not sure if it will be added back into 2.8. But it's not necessary as you can follow the following steps.

Although this allows you to bake a lightmap, I still have to find a way to switch between materials that I want to use while baking and materials that actually use the baked images.

My scene setup with the baked material in the top left:

And the red material:

And the green material:

And the blue material:

Then, after baking you'll get something like: