A common approach to updating a doc site is to build the site on a regular automated schedule, for example, daily at midnight. Netlify itself has recently introduced scheduled functions but it’s still a beta feature. Eric Jinks in Schedule your Netlify build with GitHub Actions has detailed an alternative method that involves creating a buildhook in Netlify and then adding it to a GitHub workflow.

The assumption is that you have already created an Antora playbook project for the site and have set up continuous deployment on Netlify, as described in Configuring continuous deployment of an Antora project on Netlify.

To create the buildhook:

  1. In Netlify, select the relevant site and open Site settings.

  2. From the left menu, click Build & deploy.

  3. Click Add buildhook.

  4. Provide a name for the webhook. For example, Trigger <my-site> build.

  5. Specify the branch to build.

  6. Click Save.

  7. Copy the buildhook.

To add a workflow in GitHub:

  1. In the playbook project, create a /.github/workflows folder.

  2. Create a main.yaml file with the following content:

    main.yml
    # .github/workflows/main.yml
    
    name: Trigger Netlify Build
    on:
      schedule:
        # Run daily at midnight UTC
        - cron: '0 0 * * *'
    jobs:
      build:
        name: Request Netlify Webhook
        runs-on: ubuntu-latest
        steps:
          - name: Curl request
            run: curl -X POST -d {} <your_build_hook>
  3. Push the changes to the playbook project to the GitHub repo.

    This creates a workflow that runs at the scheduled time. When run, a CURL request containing the buildhook is sent to Netlify, triggering the build of the site.

To monitor the workflow in GitHub:

  1. Select the content repo to which you added the workflow.

  2. Click Actions:

    GitHub workflows
  3. Click the relevant workflow link.