Deploy via CLI with multiple netlify.toml in subdirectories

Hi, my netlify app URL is:

I’m running the build & deploy steps in a self hosted Gitlab instance, so I’m using netlify CLI to deploy two builds for two websites (in a monorepo). The commands I use are :

  • netlify deploy --site $NETLIFY_SITE_ONE_ID --auth $NETLIFY_AUTH_TOKEN --prod --dir ./site-one/build

  • netlify deploy --site $NETLIFY_SITE_TWO_ID --auth $NETLIFY_AUTH_TOKEN --prod --dir ./site-two/build

In addition, I need to specify custom headers and redirects. When I create a single netlify.toml at the root of the monorepo, it is detected and the configuration is applied. However, each site requires different headers and redirects. I tried to put one in each site directory, but these files are not detected.

Is there any way to solve this issue?

Thanks a lot!

Ok, adding a cpcommand just before netlify deploy works :slight_smile:

1 Like