1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

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

    Chris BiscardiChris Biscardi
    gatsbyGatsby
    netlifyNetlify

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

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Discuss

    Discuss

    Transcript

    Transcript

    Chris Biscardi: 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.

    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.

    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.

    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.

    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.

    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.