Setting up continuous deployment for a Gatsby site in yarn workspaces using Netlify

Chris Biscardi
InstructorChris Biscardi

Share this video with your friends

Send Tweet
Published 2 years ago
Updated a year ago

We set up the build command, deployment directory, and other necessities to get our Gatsby site auto-deploying on commit to Netlify.

Chris Biscardi: [00:00] Now that we've pushed up our Gatsby site, we can deploy it. We're going to use Netlify because Netlify supports everything that we need from static site hosting to lambda functions. You can see all of my other projects, such as and We'll create a new site from Git.

[00:17] I log in to GitHub. After searching for my repo, it pops up. Now we're in the deploy settings. We want to deploy the master branch. I own it. We need to specify the build command in the publish directory.

[00:35] The build command will be run from the root of our project. We'll run yarn workspace www build to run the build script in the www workspace. The publish directory will also be inside of packages. We'll point to packages/www/public and we'll deploy our site.

[00:53] While the site-deploy is in progress, we'll change some of our site settings. If we scroll down, we can change the site name. In this case, I'm going to name it the same as the Git repo, You can also choose a custom domain name and set all of that up. We won't be doing that for this project.

[01:17] We check on our deploys, we can see the build logs. Netlify says the site is live and Gatsby is built. We can go back to our overview, and click on the name that we just created and send it to our site. This is our site in production.

[01:33] Now, whenever we make updates to our GitHub repo, it will be automatically deployed on our site. This includes the functions that we're going to write later that will connect to Fauna.