This workflow triggers based on the push to the main branch, but only if any file within the docs/ directory or mkdocs.yml is updated.
It also needs permission to publish to GitHub Actions, therefore we use the contents: write permission to grant it so. This deploys the documentation to a branch called gh-pages which the GitHub Pages configuration has been configured to listen too.
This job clones the repo and configures the latest Python 3 version available at runtime. This is because Material for Mkdocs is managed as a package using Python's package manager pip. A cache is then generated and mkdocs-material is installed. Lastly, it is deployed to the gh-deploy branch.