Configure Build Hooks
Learn how to configure Build Hooks.
This section provides information on how to configure build hooks on your backend.
What Are Build Hooks?
The Build Hooks module triggers builds in one or more Front-End Sites when content changes occur, such as creating, updating, or deleting.
Refer to the Front-End Sites Overview guide for instructions on how to create and manage Build Hooks in the Pantheon dashboard.
Install the Build Hooks Module
The Build Hooks module is already included as a Composer dependency if you are using the Decoupled Drupal Composer Managed starter template. For other projects:
Run the following command to add the module as a dependency:
composer require 'drupal/build_hooks:^3.3'
Install the dependency. This can be done either through the Drupal admin dashboard or using drush pm-enable.
Set Up a Build Hook
Trigger a Deployment Automatically When Content Changes
Generate a Build Hook on your build platform.
Select Configuration, select, Build hooks, and then select Frontend environment.
Click the Add Frontend environment button.
Fill out the form with the required information including Label, URL, Deployment strategy (for this use-case, select When content is updated), Weight, and Build hook URL.
Save the form.
This will automatically trigger your build hook when content changes.
By default the module will only log changes for content entities. If you would like to trigger build hooks based on other entity updates, go to Administration, select Configuration, select Build hooks, and then select Build Hooks Settings to configure other entities.
Trigger a Deployment Manually
You can create a build hook that can only be triggered manually. This can be useful if you want more control over the deployment or if you prefer to batch multiple content changes into a single deployment.
Generate a Build Hook on your build platform.
Select Configuration, select, Build hooks, and then select Frontend environment.
Click the Add Frontend environment button.
Fill out the form with the required information, including Label, URL, Deployment strategy (for this use-case, select Manually only), Weight, and Build hook URL.
Save the form.
Create or update content and then go to
admin/build_hooks/deployments/<BUILD_HOOK_MACHINE_NAME>
Click Start a new deployment to the <BUILD_HOOK_NAME> environment. This triggers the build hook on the Front-End Site.
The deployment strategy can also be set to Cron Job. This triggers the build hook automatically at a specified interval if Cron is configured on your site.