Hi,
I want to have both automatic git build and netlify-cli triggered deploy. But I only want to publish sites by netlify-cli to make sure that sites are published only after my CI passes. The reason why i still want automatic git build is that my CI took a long time, the automatic git build can show result faster, which is a better dev experience.
I tried stop auto publishing
on netlify UI, but it will disable the publish from netlify-cli deploy too.
Is there a workaround for the case?
Or can i only have deploy preview
triggered by git push, without publishing the sites?
Thank you!
Clair
Hi @clair-hu-525,
I think the best way for you would be to create 2 sites: One deploying from Git and other from CLI because the configuration you’re looking for, won’t be possible.
Sound solid! Just curious will there be extra charge if i have more sites?
Not really. You can have unlimited websites. There’s a soft limit of ~500 to prevent spam, but the support team can increase it for you once you hit it.
1 Like
and it is possible to have 2 sites pointing to the same netlify.toml file?
Yeah, definitely. the TOML file would exist in the repo, so there’s no problem there.
awesome! thank you so much Hrishikesh!
another question, for the site deploying from Git, there will still have one published site right? it will conflict with my publishing sites from CLI.
can the site deploying from Git only do building, without any publishing (which is what i want)?
Hi @clair-hu-525,
You can lock publishing so Netlify will build but not publish:
can i lock it from the very beginning? to make sure there is no publishing from the start
You’d need an initial published deploy and then you can lock it.
but won’t this published deploy conflict with the published deploy from cli? since they are publishing to the same url address (using same netlify.toml file)
I don’t understand. I thought you were going to have 2 different websites: 1 using Git, other using CLI.
About the TOML file, that file is not responsible for deciding which site to publish to.
i thought you were suggesting have 2 nelify sites for 1 website. Or the question is, if the netlify-site-1 by git published a site, then i lock the publish, then netlify-site-2 by cli keeps automatic publishing, will the actual website be updated by netlify-site-2, or it is blocked by the published version by netlify-site-1?
Yeah, that’s what I was suggesting. 2 websites sharing the same code, except one is deployed from Git push and the other is deployed from CLI. So this is how the workflow would look like:
- Create a website from Git. Deploy it and lock publishing to that deploy.
- In the folder on your computer, run
netlify link
and create a new website for that folder.
Now, whenever you run git push
, Netlify will build the website connected to Git, but won’t publish the changes live.
Then, to update the CLI-based website, you’d have to run netlify deploy --prod --build
. This would update the CLI based website and won’t touch the Git based website as the CLI is linked only to one website.
Basically, you’d be creating 2 websites from the same repo, one would be deploying via Git (so it would be connected to your repo) and other would use manual deploys (via CLI).
1 Like