Can I deploy using Netlify CLI only?


We run a bunch of end-to-end tests using GH Actions against our site, first locally, then build and deploy it (using Netlify CLI) and command

run: npx netlify deploy --dir build --json | tee deploy.json

From deploy.json we get deploy_url and run smoke tests against it. Then, if everything is good, we deploy to production (which is fast, since the site hasn’t changed)

run: npx netlify deploy --prod --dir build --json | tee deploy.json

We want the production site to get this deploy BUT meanwhile, Netlify deploys the site from GitHub repository, and our site overwrites it from GH Action. At best, this is duplicate work, at worst, the auto-deployed site (directly from GitHub) will be broken. On CI the tests would catch this, but … auto-deploy has already happened.

Is there any way we can ONLY deploy using Netlify CLI, skipping auto-publishing from GitHub but without locking the last prod deploy?

I have found a similar issue Files appear in deploy preview but not in production that explains that IF auto-publishing is OFF, then the last prod deploy stays locked.

GH workflow file:
Typical GH run:

Hi, @bahmutov, we can unlink the repo from the Netlify site. If this is done, no build at Netlify can occur until a new repo is linked. Deploying is still possible in this state though.

You are able to still deploy using the CLI, “drag and drop”, or to use the API in your own code to manually deploy the site.

Would that solution meet the requirements for this site?

Hi Luke, yes, that would work, and after looking at UI I understand this is something only you can do, I cannot do myself, right?

Hi, @bahmutov, unfortunately - yes. At this time, only our support team can “delete” the repo link. You can change it but not delete it.

The only workaround for this is to completely delete the site itself. Again, though, if you contact here on the #admin topic in community and tell us the Netlify subdomain (or site API ID) which needs the repo unlinked, we’ll be happy to do that.

There is also a feature request for this to be possible via our web UI (so you don’t need to contact our support team to do this). If/when that becomes possible we will follow-up in this community topic to let you know about it.