---
name: deploy-site-to-netlify
description: Deploys a web project to Netlify with the Netlify CLI - check login, link or create the site, confirm build settings in netlify.toml, ship a draft preview, then promote to production. Use when the user wants to host on Netlify, publish a preview deploy, link a repo to Netlify, or fix a Netlify build setting.
license: Apache-2.0
compatibility: Needs Node 18+ and a Netlify account
metadata:
  category: deployment
  tags: "netlify,hosting"
  author: johnny-bravo
  version: "1.0"
  updated: "2026-11-02"
  status: published
  aliases: "netlify deploy, netlify cli, deploy preview"
  source_url: "https://github.com/openai/skills/tree/49f948faa9258a0c61caceaf225e179651397431/skills/.curated/netlify-deploy"
  source_license: Apache-2.0
  copyright: "Copyright (c) OpenAI (openai/skills, netlify-deploy); Apache License 2.0 text in LICENSE.txt"
  original_author: "OpenAI (openai/skills, netlify-deploy)"
  modified: "Modified by TheSkillVault on 2026-11-02: rewritten for beginners as preview-first steps with a minimal netlify.toml; removed sandbox notes and long example output; added token safety, gotchas and done-when. Not the original file."
  imported_on: "2026-11-02"
---

# Deploy a site to Netlify

Netlify builds your site and hosts it. Ship a draft preview first, check it, then publish.

## When to use
- You want to put a site or front-end app live on Netlify.
- You need a shareable preview link before publishing.
- The Netlify build uses the wrong command or folder.

## Steps
1. Build locally (`npm run build`) so you know the build command and output folder work.
2. Run `npx netlify status`. If you are not logged in, run `npx netlify login`.
3. Link the folder: `npx netlify link` for an existing site, or `npx netlify init` to create one.
4. Add a `netlify.toml` so settings live in the repo:

```toml
[build]
  command = "npm run build"
  publish = "dist"
```

5. Add secrets in the Netlify UI or with `npx netlify env:set NAME value`. Never commit them.
6. Ship a draft: `npx netlify deploy`. Open the draft URL and click through key pages.
7. Ask before publishing, then run `npx netlify deploy --prod`.
8. Report the live URL and the deploy log link.

## Gotchas
- The publish folder differs by tool: `dist` for Vite and Astro, `build` for Create React App, `out` for a static Next.js export.
- Single-page apps need a catch-all redirect (`/* /index.html 200`) or deep links return 404.
- A `NETLIFY_AUTH_TOKEN` is a password. Keep it in CI secrets only.
- Environment variables set after a deploy need a fresh deploy to take effect.

## Portability
Works with any static or Jamstack framework. If you use Next.js, Netlify's Next.js runtime is added for you; the same preview-then-prod flow applies instead of a manual export.

## Example prompt
"Put my Astro site on Netlify. Give me a preview link first, then publish when I say so."

## Done when
- A draft URL was checked, then the production URL loads.
- `netlify.toml` holds the build command and publish folder.
- No tokens or secrets are committed.

---
Modified from "netlify-deploy" in openai/skills (Apache-2.0). Changes by TheSkillVault are listed in the metadata above. See LICENSE.txt.
