0

I have a next.js application on Azure static web apps. I've got it building on commit to github (via github actions). Next task is for changes on contentful to trigger a build on Azure.

Am pretty new to Azure, can anyone advise how I do this?

John
  • 29,788
  • 18
  • 89
  • 130
webknit
  • 99
  • 1
  • 9

1 Answers1

1

Contentful provides the ability to use webhooks, these are URLs to hit when content is changed. Using these you can use a webhook trigger in the github action to trigger the build and inturn the deploy.

https://www.contentful.com/developers/docs/concepts/webhooks/
https://kontent.ai/blog/how-to-trigger-github-action-using-webhook-with-no-code/

John
  • 29,788
  • 18
  • 89
  • 130
  • My question was on changes in Contentful triggering a deployment in Azure. Are you suggesting this have something to do with Github? – webknit May 13 '22 at 07:40
  • I completly misunderstood, I will update my answer. – John May 13 '22 at 09:01
  • Great so I can call a Webhook to trigger a Github action which in turn will build on Azure. That makes sense. However would it be bad practice rather than connecting Contentful directly to Azure? – webknit May 13 '22 at 09:21
  • 1
    I would not say so, this has the advantage that the secrets needed to connect to Azure are not shared with Contentful and are kept in one place in Github. – John May 13 '22 at 09:28
  • 2
    This worked a treat thanks so will upvote. For anyone else who comes across this, this article helped me a lot. https://whitep4nth3r.com/blog/how-to-github-actions-contentful-webhooks-to-show-latest-blog-posts-readme/ – webknit May 13 '22 at 17:54
  • I also completely forgot that Next.js static incremental regeneration will enable the users to do the fetching for me, which potentially would not require the need for the Contentful webhook https://nextjs.org/docs/basic-features/data-fetching/incremental-static-regeneration – webknit May 13 '22 at 18:38