title: GitHub Pages Automation
body: <p><strong>Overview:</strong></p>
  
  <p>I'm using <a href="https://pages.github.com/" rel="nofollow noreferrer">GitHub Pages</a> feature to host documentation. I'm working on a CI/CD process to automate the build so that when the source for the documentation is updated it automatically rebuilds the content and deploys to GitHub Pages.</p>
  
  <p><strong>Details:</strong></p>
  
  <p>So far, using <a href="https://aws.amazon.com/codebuild/" rel="nofollow noreferrer">AWS CodeBuild</a>, I've implemented the following:</p>
  
  <ol>
  <li>Pulls down source from GitHub Repo</li>
  <li>Uses <a href="https://www.mkdocs.org/" rel="nofollow noreferrer">MkDocs</a> to build and deploy to the special gh-pages branch using the "<a href="https://www.mkdocs.org/user-guide/deploying-your-docs/" rel="nofollow noreferrer">mkdocs gh-deploy</a>" command.</li>
  </ol>
  
  <p>This is done with command lines in the CodeBuild Buildspec. The reason I'm using commands is that I want to use <a href="https://developer.github.com/v3/guides/managing-deploy-keys/" rel="nofollow noreferrer">GitHub Deploy Keys</a> opposed to creating user account (used as a machine account) that my team would need to manage.</p>
  
  <p>I have it all working except what triggers the build. If the process was using a user account to authenticate then I can use <a href="https://aws.amazon.com/codepipeline/" rel="nofollow noreferrer">AWS CodePipeline</a> which creates a <a href="https://developer.github.com/webhooks/" rel="nofollow noreferrer">Webhook</a> within the GitHub repo, and then notifications are sent via the Webhook to say that the master branch was updated, which would trigger a new build.</p>
  
  <p>I'd like to implement a similar process but using the GitHub repo's Deploy Key. Any suggestions?</p>