NextJS rebuild periodically / "cronjob" #12486
-
I was looking into the API of a shop. They want you to import the products you create in that shop every day for example (and I think that's a conventional way of doing it) if you decide to create your own shop instead of using one of their services. I was wondering if something like that is possible in NextJS? I know that with methods like Is there something like that possible with now and NextJS? Or are there other alternatives? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
You can use GitHub actions to do this. Here's an example action running on a cron: https://github.com/specfm/design-details/blob/master/.github/workflows/deploy.yml name: weekly episode deployment
on:
schedule:
- cron: '30 12 * * 3'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: amondnet/now-deployment@v2
with:
zeit-token: ${{ secrets.ZEIT_TOKEN }}
now-args: '--prod'
now-org-id: ${{ secrets.ZEIT_ORG_ID }}
now-project-id: ${{ secrets.ZEIT_PROJECT_ID}} These secrets can be found after you link a project for the first time with |
Beta Was this translation helpful? Give feedback.
-
I will also post my need here because I also need to update the build as soon as data coming from getInitialProps changes (basicaly this is like a cms, user changes data in backoffice and he wants to see it deployed in the build promptly). This as nothing to do with the github, vercel or any other infrastructure... |
Beta Was this translation helpful? Give feedback.
-
I use getStaticProps and getStaticPath to create static url. And I use api to fetch new data too. It will be always newest data. Did you try ? |
Beta Was this translation helpful? Give feedback.
You can use GitHub actions to do this. Here's an example action running on a cron: https://github.com/specfm/design-details/blob/master/.github/workflows/deploy.yml
These secrets can be found after you link a project for the first time with
now
. This generates a.now
directory in your project, …