I added an A record to my DNS records at the registrar pointing to all of the four IP addresses provided by Github from the apex domain example.com:
185.199.108.153185.199.109.153185.199.110.153185.199.111.153
Next I went in and added a CNAME record for the www sub domain pointing to username.github.io.And then I finally enabled the custom domain example.com under the settings tab of the repository (under Github Pages > Custom Domain), and also enabled the Enforce HTTPS option after it was enabled within about an hour.
