To set up a Netlify Build Hook for Sanity, follow these steps:
- Inside the Netlify project, go to:
Project configuration > Build y deploy > Build hooks > Add build hook - Fill in the fields:
- Build hook name:
Deploy from Sanity - Branch to build:
main
- Build hook name:
- Click Save.
- Netlify will generate a URL similar to: https://api.netlify.com/build_hooks/yyyyxxxxxyyyxxdxxx
- The numbers and letters part
yyyyxxxxxyyyxxdxxxis what you need to copy into thecms/env.localfile. - Finally, deploy your Sanity project with:
sanity deploy
If everything went well, you should now be able to trigger deploys from Sanity Studio > Deploy.