2

How do I make gatsby in gitlab watch for changes in contentful then gitlab will automatically deploy it to S3? help

I'm a beginner.

  • 1
    Hi Jonathan, I know this is not an answer to your question, but as an alternative you might consider using Netlify instead of s3. Netlify will integrate with Gitlab and watch for changes, and rebuild your site. It can also be used with a Contentful webhook to rebuild your site whenever content is published. https://www.netlifycms.org/blog/2018/06/netlify-cms-now-supports-gitlab-as-a-backend https://www.contentful.com/developers/docs/extensibility/apps/netlify/ – Gordon Burgett Jan 24 '20 at 15:12

2 Answers2

1

First, you should set up your Gatsby site to be built by Gitlab and deployed to S3. Here is an blog post which goes through how to do that. Then you can use the Contentful Gitlab webhook template to setup a webhook which, when content is published in Contentful, will trigger the Gitlab pipeline you've set up above.

Here's an article written by Gitlab about deploying your project on Gitlab to S3. It's not specific to Gatsby or Contentful, but might also be helpful.

CharlieC
  • 502
  • 3
  • 8
0

first you will need to connect your Contentful and Gatsby. For this, you have to create tokens in Settings > API keys and ADD API KEY. Then you need to write in your .env file these tokens: space id and contentful delivery API token. Besides doing this manually, you can do it via npm run setup, before this command check if you have installed npm. After all this, you can now test Contentful and add some Entries and then develop your Gatsby. Now, you can write the GitLab CI, you have to create 2 jobs in your pipeline: build and deploy, there are a lot of videos how to do it.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 04 '22 at 01:22