Publishing Markdown posts from bitbucket to WordPress

I have a lot of markdown documents stored in a BitBucket repository. The md documents change often so I use it to track changes.

I was now playing with the idea to ‘publish’ these MarkDown documents to a WordPress site.

Is it possible to setup a continuous deployment of MarkDown documents to a WorPress site. And if so, any pointers on how to get this started?

Thx,

1 Answer
1

It is possible although it would take quite a bit of initial setup.

I recommend learning about Bitbucket’s webhooks. This is how you would have Bitbucket essentially talk to your WordPress install. You would create a plugin or a theme template that has a physical url to it that you point the webhook to.

When a commit is made, bitbucket will send a payload to that url and a php script will update the existing post in the database based on the changes made. If it is a new markdown file, a new post is created, if the post already exists, it will update. This would of course be the hardest part of all of it.

See wp_update_post & wp_insert_post functions in the WordPress codex:

Leave a Comment