Skip to content

Code to synchronize the blog, from Ghost to Git and from Git to Ghost

Notifications You must be signed in to change notification settings

ippontech/blog-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Blog Sync

This contains code to synchronize our Ghost blog with Git.

GitHub Webhook - Git to Ghost on updates

A WebHook is defined on GitHub to upload new or updated posts to Ghost.

The webhook will only process commits made on the master branch: anything committed to another branch will be ignored. If a Pull Request is merged onto master, Ghost should be updated.

This relies on some AWS infrastructure:

  • GitHub calls an API Gateway endpoint.
  • The API Gateway endpoint triggers a Lambda.
  • The Lambda executes com.ippontech.blog.import.LambdaHandler.

If Ghost doesn't seem to be updated within 30 seconds after a push onto master:

  1. Check the logs of the Webhook on GitHub.
  2. Check the logs of the Lambda in CloudWatch.

Bulk import from Git to Ghost

To synchronize Ghost from Git in bulk, you can use the com.ippontech.blog.import.LocalGitRepoToGhostKt entry point.

You will need to specify the location to a local checkout of the Git repository.

You can then edit the main function to either update all the posts or only a few ones.

Bulk export from Ghost to Git

To export all the posts from Ghost to Git, you can use the com.ippontech.blog.export.GhostToGitKt entry point.

You will need to specify the location to a local checkout of the Git repository where to export to.

Once the export is complete, you will need to commit & push to Git. Make sure you have a clean checkout prior to running the export.

Environment variables

All the entry points require 4 environment variables to be specified:

  • GHOST_USERNAME
  • GHOST_PASSWORD
  • GHOST_CLIENT_ID
  • GHOST_CLIENT_SECRET

About

Code to synchronize the blog, from Ghost to Git and from Git to Ghost

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages