Home
Support Forums

Deploy Notification for not auto-publishing project

Hello everyone,

For Notification I didn’t find the way to trigger a hook for not auto-publish project who have just been published.

Use case is purging cache on Cloudflare when we publish site live. As publish production is critical step, we could potentially use it to communicate to team that new live version is publish too.

Thank you for your help :slight_smile:

Not the answer you’re looking for, but, it’s not recommended to use Cloudflare along with Netlify. You may read about it here: https://www.netlify.com/blog/2017/03/28/why-you-dont-need-cloudflare-with-netlify/.

As far as your question is concerned, I sadly didn’t exactly understand the first line. ‘Trigger a hook for not auto-publish…’. Could you please rephrase it?

1 Like

Thank you for you answer,

I’m not using auto-publishing on my project. When you choose auto-publishing, notification can be triggered just before is going public using “Deploy succeeded”. In case of not using auto-publishing, when you deploy your specific build to go public, you don’t have a way to get a notification for that. Use case is not only for Cloudflare, but could be for slack integration or email.

I had to choose Cloudflare for worker as it’s not something Netlify offer so far. And it’s not “Not recommended”, it’s just in most case you don’t need it, and i completely agree.

Well, the ‘Deploy succeeded’ notification means the website is public. That’s what it says in the docs: https://docs.netlify.com/site-deploys/notifications/

Quoted:

  • Deploy succeeded : Emitted when Netlify finishes uploading a new deploy to our CDN.

Also, I have a website that’s deploying manually and I can set-up a notification for that. It exists here:
https://app.netlify.com/sites/<site name>/settings/deploys#deploy-notifications. Doesn’t that suffice for your use case?

After testing on my side, ‘Deploy succeeded’ is triggered at this end of build not when website go public.

I don’t understand. When you’re manually publishing a build to Netlify, there’s no building that actually takes place. The only thing that might be taking place is form detection and post processing. And the deploy success would trigger right after the changes are made live.

So when you say at the end of the build, when exactly is it getting triggered?

Sorry @hrishikesh if I have difficulty to explain my problem.

All my deployment is made by Git. So after push on master, Netlify build the new version and if it succeed a notification is send “Deploy suceeded”. In my case i don’t use the auto-publishing option so this build is not going live. When I click the “publish deploy” button, I don’t find a way to get a notification.

Hope it’s little bit more clear like that.

Oh, so that’s what you’re referring to as manual deploy. I thought, you were just directly uploading an already built website.

Well in you case, you want to get a receive a notification when you click Publish Deploy, so, you should have a look at ‘Deploy started’. Does that work?

Thank @hrishikesh for you answer.

Unfortunately It doesn’t work, ‘Deploy started’ is triggered only at start of build.

That’s what the ‘Publish deploy’ button does right? It starts the build.

‘Publish deploy’ button is only available after your build succeed. When triggered, it push your website live, replacing the previous “public” build. Amazing features by the way ^^

So, I just disabled auto publishing for one of my websites to test the webhooks. I was able to get a notification in my Discord (I had to use the Slack integration). I created a new notification for ‘Deploy started’ event and clicked on ‘Deploy site’ button:

image

I got a notification in my Discord at the very moment.

Yes It’s deploy, but it’s not publishing.
If I’m not confused, deploy site relaunch the build but doesn’t publish your website.Capture d’écran 2020-10-28 à 7.33.06 PM

Deploy site is the trigger for the entire process. It builds and also publishes.

Sorry, but not in my case. deploy site only rebuild. Maybe it’s different dashboard between git deployment and file deployment.

Do you mind sharing your ‘build log’ after you click on Deploy site? In the end, it should say ‘Site is live’.

It say “Site live” and create an hash url to preview the website. When you click publish, it goes live.

Now I see where the problem was. My apologies for taking so long to understand your problem. Yeah, indeed, when you’ve auto publishing off, the changes won’t be published till you click on publish and sadly there’s no event yet to get a notification for that. You might have to try to manage your workflow using the deploy start or deploy success events.

However, since you’re going to publish manually, you can get the notification by clicking on Trigger deploy and once the deploy is done, publish it. That’s the only way around if you don’t want to turn on auto publishing.

1 Like

You could also change your process to use deploy previews, when changes are made you can trigger a webhook, decide if you want to publish and then call a build hook to create the build? (And have auto publish on) then you’re publishing only approved changes via pull requests

Thank you @hrishikesh and @AaronP ,
But I’m still confuse on use case for “Locked deploy” and “Unlocked deploy”.
In my mind when you are using “stop auto-publishing”. You locked (publish deploy) by yourself every-time you rollback from different deploy version or publish a new one.

But in reality the notification for lock, unlock deploy is only for stop/start auto-publishing. so that mean I should toggle start/stop auto-publishing to have a notification related to publishing website.
That could do the job, but feel like the fact of locking (publish deploy) by myself is similar action.