Triggering publish with a webhook

Right now, this is how my master branch is deployed:

If I enable auto publishing:

  • Push some changes to master
  • Netlify deploys and publishes the branch (regardless of whether my checks passed)
  • My CI builds the branch and runs tests
  • If the tests pass…
    • The Netlify deploy webhook is called
    • Netlify deploys and publishes the branch again

If I disable auto publishing:

  • Push some changes to master
  • Netlify deploys (but doesn’t publish) the branch
  • My CI builds the branch and runs tests
  • If the tests pass…
    • The Netlify deploy webhook is called
    • Netlify deploys but does not publish the branch

This is what I want to happen:

  • Push some changes to master
  • Netlify deploys (but doesn’t publish) the branch
  • My CI builds the branch and runs tests
  • If the tests pass…
    • A Netlify publish webhook is called
    • Netlify publishes the deployed branch

Is this possible?

Bit of an odd workflow - do you really want us to build the preview and then rebuild it to publish, without any changes?

I’d suggest that instead of calling the webhook after your CI passes, you instead call an API endpoint to publish the existing deploy. Saves you $$ on build minutes too :wink:

https://open-api.netlify.com/#operation/restoreSiteDeploy is the “publish this deploy as production” call, and then if you want to be careful, you can make sure that autopublish is disabled again: https://open-api.netlify.com/#operation/lockDeploy