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

Chris Biscardi
InstructorChris Biscardi
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 3 years 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 partycorgi.com and partycorgi.me. 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, .netlify.com. 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.

egghead
egghead
~ 17 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today