Disable Continuous Deployment on netlify
Asked Answered
W

1

6

I have a project where I use Travis CI for CI. I also have a website setup at netlify to deploy said project to. The steps involved in my Travis CI are basically to run tests and then call a netlify build hook to trigger a build and deploy on netlify.

However, the problem I'm running into is that netlify does a build and deploy every time the master branch is updated. So, what I'm trying to achieve is this

  • master branch updated
  • travis build triggered
  • after travis finishes it calls netlify build hook which start netlify deploy

There seems to be an option with netlify to add a skip-ci commit message but I'm hoping for a better and automated solution.

Weevily answered 30/9, 2019 at 4:35 Comment(0)
A
15

Stopping automatic deploy of your site build

There is the ability to stop auto-publishing per site on Netlify. In the Netlify admin console, login and choose the site > Deploys then "Stop auto publishing"

enter image description here

"Stop auto publishing" does not turn off builds or previews in Netlify CI for your site. It only stops the atomic deploy of changed site files! To deploy a build, you would have to deploy manually.

Turning off builds for a branch

This will depend on what you are trying to do, but we will walk through a couple cases.

Build case #1 (no build needed)

You might have a site that is being pre-built on a 3rd party CI system, like GitHub Actions as an example, and your workflow is to push your static site changes back to the repository. In this case you are not turning off the build step, but want it to publish when there are changes.

Solution: Create build command that does nothing. For example, "echo 'There is nothing to build here!'"

Build case #2 (no continuous deployment, manual deploys)

Although this is used for CLI deploys there might be other reasons for you wanting to ignore a branch. You just don't want the site to do anything, because it is being built and deployed via netlify-cli.

This method uploads files directly from your local project directory to your site on Netlify (Read here).

Solution: change your production branch to a non existing branch name in the admin console for the site (ie. does-not-exist), then turn off deploy previews and set to only build the production branch which does not exist.

enter image description here

Anemic answered 30/9, 2019 at 17:50 Comment(4)
Hey, I've tried this already but I just tried this again and it still starts building as soon as I make a commit to masterWeevily
I would send an email to support then, because that should not happen if we are talking about the same thing.Anemic
I can verify that this still is not preventing deployment on commits, but it should. The reason I want this off is because continuous deployment is not compatible with netlify lambda functions created via CLI (Netlify Dev).Roughish
@JeffLowery "Stop auto publishing" should stop deploys of your production builds. It will not stop the builds. I expanded the question to give a couple examples of stopping builds and previews. There are a lot of cases that could be handled with settings and some of them aren't super clear without the knowledge and testing of how continuous deploy works on Netlify.Anemic

© 2022 - 2024 — McMap. All rights reserved.