Create deploys
This page covers features and tools you can use to create deploys with or without continuous deployment.
Note
When you create a deploy manually without continuous deployment, Netlify does not run a build command.
# Deploy with Git
Continuous deployment works by connecting a Git repository to a Netlify site and keeping the two in sync. This is done using the Git provider’s OAuth2 authentication or the Netlify GitHub App.
After you set up Git provider permissions and link a repository, Netlify will run your build command and deploy the result whenever you push to your Git repo. The benefits of Netlify’s continuous deployment include:
- No deploying without committing and pushing first
- Easy collaboration through pull/merge requests
- Fix a typo through your Git provider’s web UI from your mobile
- Edit content without code by using a CMS
# Netlify CLI
You can use the CLI to set up continuous deployment for a Git repository. Once continuous deployment is configured, you can update your Production site, staging site, or Deploy Preview with git push
.
You can also use the CLI to create manual deploys without continuous deployment. For example, you can deploy directly to your production site from the command line with netlify deploy --prod
.
# Drag and drop
You can create a new site by dragging a project folder to the deploy dropzone in Netlify Drop or at the bottom of your team’s
page.If you need to update a site that you created using drag and drop, update and rebuild your project locally. Then, drag the project’s updated output folder to the deploy dropzone at the bottom of the site’s Deploys page. This will start a new site deploy with the updated files. You can also use this functionality to manually update any site that is not connected to a Git repository.
# API endpoints
You can use the API to create deploys manually using a file digest or a ZIP file.
# Deploy to Netlify button
The Deploy to Netlify button helps users deploy new sites from templates with one single click. It provides web developers a simple one-click step to let their users deploy those applications on Netlify.
It’s designed to be used in README files, documentation sites, and probably anything that renders as an HTML file.
You can find examples of the button in use in the READMEs on our templates.
The template code must be available in a public repository stored on GitHub.com or GitLab.com.
# Markup
You can use any markup language that renders as HTML to display the button. There are two very important URLs that you’ll need:
The SVG URL for the button:
https://www.netlify.com/img/deploy/button.svg
.The URL the button takes users to:
https://app.netlify.com/start/deploy
. This link requires the public Git repository as a parameter, for example:https:/start/deploy?repository=https://github.com/netlify/netlify-statuskit
You can make the button clone a whole repository or just a portion of a repository. Both are good options for monorepos but you may need to set a base directory if the button clones the whole repository.
Here is an example of the full Markdown or HTML code for a Deploy to Netlify button that deploys the Netlify StatusKit template:
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/netlify/netlify-statuskit)
<a href="https://app.netlify.com/start/deploy?repository=https://github.com/netlify/netlify-statuskit"><img src="https://www.netlify.com/img/deploy/button.svg" alt="Deploy to Netlify"></a>
# Template configuration
You can provide a set of default values for your template directly in the template’s Git repository. Create a netlify.toml
file in the root of the repository, if you don’t have it already. We’ll read the information from there. If your Deploy to Netlify button clones just a subdirectory of the repository, create the netlify.toml
file in that subdirectory so that the file ends up in the root of the cloned repository. This file can also be used to set options for continuous deployment, you can read more about it in the file-based configuration documentation.
Within the [template]
section in that file, you can set two directives:
A list of incoming hooks for the users site. This is very useful if you want to allow a third party service to control when to deploy the site. This is what headless CMS services like Contentful and DatoCMS do. Users can give those providers the address Netlify generates for their specific incoming requests.
[template] incoming-hooks = ["Contentful"]
A list of required environment variables. This is the way to let users configure specific configuration options upon deployment. It also enables customization without having to change the code of the base template.
[template.environment] SECRET_TOKEN = "change me for your secret token" CUSTOM_LOGO = "set the url to your custom logo here"
Note that you can’t set a base directory for the Deploy to Netlify button in this [template]
section. To set a base directory for sites deployed with the button, use the base
query parameter instead.
# Pre-fill environment variables
You can pass environment variable values for the site template in the hash of the template’s Deploy to Netlify URL with key/value pairs. Using the example environment variables above, SECRET_TOKEN
and CUSTOM_LOGO
, the resulting URL will be something like this:
https:/start/deploy?repository=https://github.com/myworkspace/sweetkittentemplate#SECRET_TOKEN=specialuniquevalue&CUSTOM_LOGO=https://placekitten.com/100/100
Passing environment variable values in the hash ensures that they’re processed on the client side only. You can create custom Deploy to Netlify buttons for your users with tokens and other secure data, and they won’t appear in Netlify logs.
# Set a base directory for monorepos
If your Deploy to Netlify button clones a whole monorepo rather than a single subdirectory, you can use the base
query parameter to set an alternate directory as the base directory for deployments. The format is &base=your-base-directory
. Note that while Netlify uses the specified base directory for the build and deploy, the entire repo is still cloned to the user’s Git provider account.
For example, here’s a URL with a base directory of blog
:
https:/start/deploy?repository=https://github.com/myworkspace/sweetkittentemplate&base=blog
When someone uses this Deploy to Netlify button, Netlify clones the whole sweetkittentemplate
repository to the user’s Git provider account and then builds and deploys from the blog
subdirectory.
Note the following limitations:
- Template configuration to set incoming hooks and environment variables can only be used at root level and can’t be used for sites with a different base directory. When you set an alternate base directory, the
netlify.toml
in the base directory will take precedence over the root level configuration for that site’s builds.
# Clone a subdirectory of a repo
To make a Deploy to Netlify button clone just a part of a repo, use the create_from_path
query parameter to specify a subdirectory to clone. The format is &create_from_path=your-subdirectory
.
For example, here’s a URL with a creation path of examples/hello
:
https:/start/deploy?repository=https://github.com/myworkspace/demos&create_from_path=examples/hello
When someone uses this Deploy to Netlify button, Netlify clones just the subdirectory examples/hello
from the demos
repo to the user’s Git provider account and then builds and deploys from the root of the cloned repository.
# Build hooks
Build hooks give you unique URLs you can use to trigger new builds and deploys.
# Zapier integrations
Netlify is available on Zapier, where you can connect Netlify with over 1,000 other applications. You can use Zapier “Zaps” to start a new deploy of your site in response to a trigger from another service. You can find out more on our blog, or use one of the templates below to get started:
# n8n integrations
Netlify is available on n8n, an open source tool that allows you to connect Netlify with other applications. By using one of n8n’s Netlify nodes, you can create your own automated workflow. To get started, you can use the Netlify node, Netlify Trigger node, or you can use the existing workflow below:
Did you find this doc useful?
Your feedback helps us improve our docs.