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.

3 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: https://flaviocopes.com/netlify-auto-deploy/

1 Like

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”
https://app.netlify.com/sites/your-site-name/settings/deploys#build-hooks

4 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 .

2 Likes

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!

11 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.

2 Likes