Is it necessary to use Github pages?

No, you don’t have to use GitHub Pages. You can use Netlify instead for example if you want more control and extra features.

GitHub Pages will automatically trigger a build when you update your repository. So will other services like Netlify with the help of webhooks.