Scheduling builds and deploys with Netlify

It’s not a very exciting feature and probably would not look as glorious on a roadmap. Yeat, it would make my life with Netlify easier…

I’d really love to have an ability to rebuild sites every X hours.

5 Likes

Hi @skatkov! This is a fun idea, thanks for sharing.

In the meantime, have you looked into using Zapier to automate Netlify deploys? You can set up a Zap to POST to the Netlify webhook at a certain time to get this done. Here’s a good write-up about it: Auto trigger deploys on Netlify

2 Likes

fantastic resource, @lesliecdubs! @skatkov, can you say a bit more about why you would want to trigger a rebuild every x hours? Maybe if we know more we can suggest more workarounds.

Yeah, tried it. But paying ~15$/m for ability to rebuild website every hour with Zapier seems like too much (I don’t use Zapier for anything else) :slight_smile:

I wrote a simple cron service that does POST requests to rebuild my website.

2 Likes

Until Netlify has their own scheduler, https://www.easycron.com works really well and easy to setup. The free plan would easily allow for every couple hours.

Just in case anyone is interested, here is how easy a job is to setup.


then make it a POST method

Get the build hook from your site settings by enabling build hooks under “Build & Deploy”

6 Likes

I would love the ability to configure individual Netlify functions to run as Cron jobs

2 Likes

@skatkov

Another cron alternative, if you want to build every hour for free, you can use IFTTT Date & Time to trigger the webhook

2 Likes

We have an open request to add scheduled deploys and functions (cron tasks), I’ve noted in that more people are asking for it. https://webtask.io/ is a popular option, but they aren’t accepting new signups right now. We use Zapier internally. Thanks for that suggestion @Jinksi .

1 Like

Just to provide another solution to this, it is easy to use GitHub Actions to schedule builds.

You only need to add 1 file to your GitHub repo: .github/workflows/main.yml

# .github/workflows/main.yml

name: Trigger Netlify Build
on:
  schedule:
    # Run at 0815 daily
    - cron: '15 8 * * *'
jobs:
  build:
    name: Request Netlify Webhook
    runs-on: ubuntu-latest
    steps:
      - name: Curl request
        run: curl -X POST -d {} YOUR_BUILD_HOOK

Replace YOUR_BUILD_HOOK with your Netlify Build hook url.
You can use crontab.guru to easily generate your cron schedule.
A cron schedule of 0 */3 * * * would run every third hour, to answer the original question :point_up:

I wrote a blog post about this and created an example GitHub repo with this workflow if anyone is interested!

10 Likes

I would also love this feature to be integrated into my Netlify Dashboard.

I have tried using GitHub actions and it never seems to work correctly if at all. I have had nothing but trouble when I try it that way.

I think it would be way better if there was something within my Netlify Dashboard to handle this for me.

Thanks!

I’m sure this was free when you posted this but it is apparently no longer available on the free plan. I tried everything exactly how you have it in your screenshots and when I click the “Create Cron Job” button, this pops up…
image

Hey @cmarabate,

There’s a couple of good write-ups online which incorporate GitHub Actions. Does following something like this help?

Rest assured, our team are still assessing the feasibility of a feature such as this from within Netlify and we’ll be sure you let you know if and when it’s incorporated.

Hi, I’m also interested in scheduling builds. I’m currently using Firebase + CircleCI instead of Netlify. I also need to add Zapier to my combo. If Netlify provided Scheduling, I would probably convert to Netlify :slight_smile:

Hi everyone. I’ve created a tool that makes it easy to schedule builds and deploys on Netlify. I wrote a guide explaining the steps. It should take less than 5 minutes to do it!

Please let me know if you have any questions.

3 Likes

Thanks for sharing this @Jinksi, I have been using GitHub Actions to schedule builds, but the issue with it is that it will automatically get disabled after 60 days if no updates occur on the repo (odd!!). Curious if there’s a way to disable this (to not disable the build automatically)!!

1 Like

This appears to work on the free tier as well, I just tried setting one up on my free account and it worked.

Hey y’all :wave:t2:

For what it’s worth, and as eluded to by @dmotan, a GitHub Action can work really well for kicking off your Netlify builds. I added this Action as part of my site’s same repository, so it shouldn’t ever be stale enough to stop running (haven’t looked into that, but just wanted to throw it out there just-in-case), but I use:

To check both internal and external links from my site, so if any external links die off, I want to know about it in a timely fashion. Just make sure you have a ./.github/ directory in the root of your repo, then a /workflows/ directory inside of that.

# ./.github/workflows/main.yml

name: Trigger Netlify Build
on:
  schedule:
    - cron: '0 0 * * *' # Once a day
jobs:
  build:
    name: Request Netlify Webhook
    runs-on: ubuntu-latest
    steps:
      - name: POST to Build Hook
        run: curl -X POST -d {} https://api.netlify.com/build_hooks/<YOUR_HOOK_ID>

Then, as a certain well known Netlifier would say, It’s done!

Hope that helps :slight_smile:


Jon

4 Likes

hi all, we know you have been waiting for this for so long, but today we were ecstatic to announce that we have acquired Quirrel and integrated their functionality for scheduling functions into Netlify.

More here:

2 Likes

There is no settings UI for configuring scheduled deploys yet, correct?

Nothing in the UI @Janosh but did you see Netlify now has Scheduled functions which you can use to trigger builds?