# Netlify

> Deploy via Netlify's git integration or the CLI, with branch previews and atomic releases.

Netlify reads a small `netlify.toml` at your project root to pick up the build command and publish directory. The rest (Git previews, atomic deploys, custom domains) is handled automatically. Netlify also reads the `_headers` file every build writes and serves the build's `404.html` for unknown paths.

## Build the site

```sh
htmlpress build
```

Output lands in `.htmlpress/build/`.

## Configure `netlify.toml`

```
[build]
command = "npx gethtmlpress build"
publish = ".htmlpress/build"
```

That's all Netlify needs. The same file unlocks `netlify dev` locally if you ever want to mirror the platform's edge behavior.

## Deploy with the git integration

The recommended path: connect your repo at [app.netlify.com/start](https://app.netlify.com/start). Netlify reads `netlify.toml`, runs the build, and ships every push to `main` to production. Other branches and PRs get unique deploy preview URLs automatically.

## Deploy with the CLI

For one-shot or scripted deploys:

```sh
htmlpress build
netlify deploy --prod --dir=.htmlpress/build
```

The first run prompts for `netlify login` and links the directory to a site.

## Deploy with GitHub Actions

Netlify's git integration is usually enough, but a workflow gives you test-before-deploy gating:

```yaml
name: deploy

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v4
        with:
          node-version: 24
      - run: npx gethtmlpress build
      - uses: nwtgck/actions-netlify@v3
        with:
          publish-dir: .htmlpress/build
          production-deploy: true
        env:
          NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
          NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
```

Get the auth token from **User settings → Applications → Personal access tokens**, and the site ID from **Site settings → General**.

## Custom domain

In the site dashboard, **Domain management → Add a domain**. Netlify provisions DNS and a certificate. Set the same domain as `site` in `htmlpress.yaml`.

## See also

- [Site Metadata](/customization/site-metadata/): `site` populates the sitemap URLs.
- [Deployment](/deployment/): back to the host index.
