Deploy to Netlify

How to deploy to Netlify?

To start deploying to Netlify, you need to create a site in Netlify and set up a continuous deployment pipeline in Buddy. Netlify allows you to run static websites created with Next.js Astro Build, Gatsby, Nuxt, Solid, Hugo, Angular. You can build all of them using Buddy and deploy them to Netlify.

Image loading...Example pipeline with deployment to NetlifyExample pipeline with deployment to Netlify

Tip
If you are new to Buddy, check out our workflow guides that will tell you how to create build, test and deploy your type of application.

Configure pipeline in Buddy

  1. Create a new project in Buddy and select your Git provider.

Image loading...Creating new projectCreating new project

  1. Add a new pipeline and configure the details: name, trigger mode, and a branch from which you want to deploy.

Image loading...Adding new pipelineAdding new pipeline

Before you add the Netlify action to your pipeline, you need to create a site on Netlify.

How to create a site on Netlify?

To create a new site on Netlify:

  1. Go to Sites tab in your Netlify account and click Import from:

Image loading...Adding new site on NetlifyAdding new site on Netlify

  1. Select your Git repository provider, authorize access and select the project that you want to develop:

Image loading...Project configuration in NetlifyProject configuration in Netlify

  1. Select the team and provide the site name to finish the configuration.
  2. Since your static site is built in Buddy, you need to disable builds on Netlify to avoid duplication and prevent potential conflicts. To do it, go to the previously created site, open the Deploys tab and click Deploy Settings:

Image loading...Deploy settings in NetlifyDeploy settings in Netlify

  1. Navigate to the Build settings and click Configure. Change the setting for Build status to 'Stopped builds':

Image loading...Build settings in NetlifyBuild settings in Netlify

From now on, your site will be built by Buddy. You can now go back to your pipeline and start the configuration.

Configure Netlify deployment

  1. Look up and click Netlify on the action list to add it to the pipeline:

Image loading...Netlify action in the PaaS and IaaS sectionNetlify action in the PaaS and IaaS section

  1. The action launches a container with the Netlify CLI preinstalled. It has five configuration tabs:
  • Run – here you select the Netlify integration and provide the deployment command
  • Environment – if your process requires specific dependencies, you can install them here. The files will stay cached in the container for future pipeline runs
  • Variables – here you can add and modify environment variables required by your workflow
  • Conditions – here you configure the trigger conditions for which the action will run
  • Options – here you define the action's name and behavior on failure and timeout

Image loading...Netlify action configurationNetlify action configuration

In the Commands section, the flag:

--dir= - indicates which folder should be deployed (different static site generators may use different output folders).

--prodIfUnlocked - instructs Netlify to deploy the website to the production environment only when the deployment key is unlocked, ensuring secure control over production deployments.

  1. When ready, click Add this action to finish configuration.
Success
Congratulations! You have just automated your Netlify deployment. 🥳
Hint
Read how to configure Netlify with YAML and Netlify POST Parameters.
Last update:
Sep 24, 2024