cds-snc / resources-ressources

Learning Resources / Ressources d'apprentissage
MIT License
3 stars 1 forks source link

Automatically deploy staging when "Publish" is clicked #235

Open daine opened 2 years ago

daine commented 2 years ago

πŸ“‡ User story

As a content designer, I want to see the published content on the learning resources staging website as soon as I hit "Publish"

βœ… Definition of Done

πŸ“œ Acceptance criteria

🎨 More info

Here's how to setup incoming webhooks in AWS Amplify

I have tested this by doing click-ops and adding a webhook named contentful-publish: Screen Shot 2022-08-31 at 4 12 19 PM

TODO: Terraform that config^^^:

resource "aws_amplify_webhook" "main" {
  app_id      = aws_amplify_app.learning_resources.id
  branch_name = aws_amplify_branch.main.branch_name
  description = "contentful-publish"
}

I have created a contentful webhook for publishing. Here's what the current configuration looks like (it works!): Screen Shot 2022-08-31 at 4 14 26 PM .....and more configuration..... Screen Shot 2022-08-31 at 4 15 40 PM

How did I confirm that it works? I updated our "Contact Us" page and separated the sentences into a new paragraph (added a new line), and hit "Publish.

Webhook logs (triggered by hitting "Publish" on an entry): Screen Shot 2022-08-31 at 4 13 16 PM

Confirming that the webhook works on AWS Amplify:

AWS Amplify redeploying from the contentful webhook trigger Deployment triggered by contentful webhook

Screenshots of the website before, and after the changes:

Before deployment: Learning Resources Contact Us Page Separate Paragraphs

After deployment: Learning Resources Contact Us Page One Paragraph

I have since reverted the change, and DEACTIVATED the contentful webhook

anikbrazeau commented 2 years ago

I wonder if this also might include a mechanism to control what's in staging and what's in production?

As a content designer, I want to see the content change on the learning resources staging website as soon as I hit "Publish" or " "Unpublish" in both English and French....and want to control when that content makes it to the production site.

I'm wondering if there might be a way to remove the automatic redeployment of Contentful content when a PR is merged? Would that help us control resource content more predictably?

daine commented 2 years ago

Putting this back on the backlog for clarity & refinement

daine commented 2 years ago

Grooming notes: This is currently deactivated so it is not working We need to know if this is something we need, could we re-activate it in staging? Hitting publish would be very similar to committing code, so does a redeployment make sense?