Resources to help you deploy your Prismic and Gatsby project to one of the many providers that support static sites.
You can deploy and generate automatic builds with Gatsby Cloud. Read our guide to start integrating Gatsby Cloud into your project:
- Gatsby Cloud and Prismic ⟶
On this page, you'll learn how to setup and deploy your project on Gatsby Cloud while being fully integrated with your Prismic repository.
First, make an account or log in, then push your project code to a new GitHub repo and log in with that same GitHub account. Click on New site from Git, select your repository and continue. You should land on step 3, "Build options, and deploy!", here are the settings you need:
Property | Description |
---|---|
Branch to deploy |
main, or which-ever branch you prefer |
Build command |
npm run build |
Publish directory |
dist |
That's it; your website should now be live!
Start by creating your Build hooks endpoint on Netlify. In your Netlify site dashboard at Settings > Build & deploy > Continuous deployment > Build hooks. Generate a build hook URL; it'll be similar to the one below:
https://api.netlify.com/build_hooks/XXXXXXXXXXXXXXX
Now create a Webhook trigger in Prismic. In your Prismic repository's Settings > Webhooks, create a Webhook trigger and add the URL you just copied from Netlify, and that's all you need to add to make your project detect changes and rebuild!
When configuring environment variables with Gatsby + Netlify, you can prefix them with GATSBY_
if you need to make it public in the browser to be used in your client JavaScript. (exception NODE_ENV
). Read more about Gatsby's environment variables.
GATSBY_PRISMIC_REPOSITORY_NAME=your-repo-name
You can also check out the recommended Gatsby services for deploying if you'd like to see more options.
- Next article: Gatsby Cloud
- Previous article: Preview Drafts