Quick question about CI interaction and deploys from Github

Hi there,

This is not about a specific problem I’m having, more a request for advice on how Netlify works.

Currently, Netlify owns the building and deployment of my angular application.
I want to continue to use Netlify for hosting, it’s an awesome solution and I’m really happy with it.
I would however, like to switch the ownership of build and test pipelines to github actions.

Currently my site deploys on commit to my main and dev branches. I want that behaviour to continue, but I want Github actions to run tests before a site is deployed.

Does a Netlify site connected to a github repository wait for a CI pass before deploying a site, if one is present? How should I build this process out?

Right now netlify is just npm build-ing, should I have actions npm build and test and then ship the artifact to netlify to be deployed? Should I npm test and then let Netlify npm build and deploy as it does today?

What do all you think?

Cheers

Alex

Hiya @AlexanderNZ,

There are a lot of ways to mix GHActions and Netlify.

First off, you could run things in parallel - have GH running the test, and then polling for the deploy to complete (using our API - see [Support Guide] Understanding and using Netlify's API for omse more details), before returning a status and/or publishing the deploy.

Or, you could indeed deploy from github actions using our CLI (cf Get started with Netlify CLI | Netlify Docs) - I know there is some “published” action that does that - literally runs netlify deploy - but you could bake that into your own custom action pretty easily.

However, I can tell you that unless you configure github NOT to notify us, and instead have your ACTION notify us (probably through pre-configured buildhooks rather than in the automatic way: Build hooks | Netlify Docs) that we will NOT wait for anything except that notification to start your build here!

This article also has a lot of somewhat generic test patterns that may inspire:

Let us know what you come up with :slight_smile:

I also feel like there could be an option in Build settings to wait for GitHub actions to complete - there is no reason to build sites whenever actions fail.

Hi @AverageNetlifyBoi,

Did you try the suggestions that @fool mentioned?

Not yet. I understand the suggestions but I believe this should be much simpler, configurable option from Netlify settings.

Hi @AverageNetlifyBoi,

I think that’s what @fool has suggested here:

All you need to do is unlink the repo and send a build hook when your actions complete. So Netlify will only build then.