This contains code to synchronize our Ghost blog with Git.
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
:
- Check the logs of the Webhook on GitHub.
- Check the logs of the Lambda in CloudWatch.
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.
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.
All the entry points require 4 environment variables to be specified:
- GHOST_USERNAME
- GHOST_PASSWORD
- GHOST_CLIENT_ID
- GHOST_CLIENT_SECRET