我们可以在 vercel Deploy Hooks 中安排部署吗?(Next.js)
Can we Schedule deployments in vercel Deploy Hooks?(Next.js)
就像我们在 git 上安排管道一样,我想在 vercel
上安排 Deploy 挂钩
因为应用正在发送 getStaticProps
每个 HTTP 请求在每个构建
上都会 运行
所以我必须重建站点以从服务器
获取新结果
例如,我想每天 02:00PM
在 Vercel 上重新部署我的应用程序
我该怎么做
根据the Nextjs document你不需要这样做,有一个更简单更好的解决方案:
Next.js allows you to create or update static pages after you’ve built your site. Incremental Static Regeneration (ISR) enables you to use static-generation on a per-page basis, without needing to rebuild the entire site. With ISR, you can retain the benefits of static while scaling to millions of pages.
因此您可以像这样使用此功能:
export async function getStaticProps() {
// some code on getstaticProps
return {
props: {
// the props
},
// Next.js will attempt to re-generate the page:
// - When a request comes in
// - At most once every 10 seconds
revalidate: 10, // In seconds
}
}
有关详细信息,请查看 this link
就像我们在 git 上安排管道一样,我想在 vercel
上安排 Deploy 挂钩因为应用正在发送 getStaticProps
每个 HTTP 请求在每个构建
上都会 运行
所以我必须重建站点以从服务器
例如,我想每天 02:00PM
在 Vercel 上重新部署我的应用程序我该怎么做
根据the Nextjs document你不需要这样做,有一个更简单更好的解决方案:
Next.js allows you to create or update static pages after you’ve built your site. Incremental Static Regeneration (ISR) enables you to use static-generation on a per-page basis, without needing to rebuild the entire site. With ISR, you can retain the benefits of static while scaling to millions of pages.
因此您可以像这样使用此功能:
export async function getStaticProps() {
// some code on getstaticProps
return {
props: {
// the props
},
// Next.js will attempt to re-generate the page:
// - When a request comes in
// - At most once every 10 seconds
revalidate: 10, // In seconds
}
}
有关详细信息,请查看 this link