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
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.
What is it? Basically it means that we build, configure and deploy your site every time you push to Git (be it a self-hosted repo, GitLabs, Bitbucket or of course GitHub). So you don't have to do anything manually.
As you push changes to Git, Netlify will automatically build and deploy from your main branch.
Continuous integration has never been simpler. Netlify can connect to any Git repository hosted at GitHub, GitLab, or Bitbucket and auto publish every time you push a commit.
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"
"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.
This will depend on what you are trying to do, but we will walk through a couple cases.
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!'"
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With