2 min read

GitOps Your Ghost Publishing

A Git-first workflow for publishing to Ghost that mirrors how you ship code versioned, stateless, and CI-friendly.

Alright, let’s get meta. This blog is about DevOps and Git—so I’m kicking it off by showing you how I ship this blog. With ghostpost, a tool I built that lets me publish to Ghost the same way I manage code: in Git.

Publishing Like a Dev: Meet GhostPost

You use Ghost because it’s modern, open, and built for professional creators. It gives you newsletters, subscriptions, and a full publishing stack that doesn’t sell your soul to adtech.

You use Git because you want version history, branches, and working with the all mighty plain text.

ghostpost is a GitOps-style CLI for managing Ghost posts.

Each post lives as a Markdown file in your repo. The front-matter stores all metadata—including the Ghost post_id.

You edit locally. You commit. ghostpost publishes.

Why I Built This

I wanted a writing workflow that matched how one might ship code.

  • No fragile CMS UI edits
  • No "oops I deleted the draft"
  • No back-and-forth between browser and source doc

The Ghost GUI becomes just a preview tool. Nothing gets edited in it.

Not necessarily a new idea—post2ghost laid out the same "Articles as Code" concept where content belongs in Git. The CMS should be a rendering layer, not an editing platform.

That post nailed the philosophy:

  • Keep Markdown files under version control
  • Write in your editor of choice
  • Automate publishing with API calls

It was still a bit DIY and python based which is a dependency headache -- I love python, but not for cli tools...

ghostpost takes that same idea and wraps it in a clean CLI. One command and simple.

How It Works

You write a post in Markdown, with front-matter like this:

---
title: Your title here
slug: your-slug
custom_excerpt: Short summary here
tags: [DevOps, Ghost]
feature_image: images/cover.jpg
status: draft
---

Your content in Markdown.

Then you run:

ghostpost publish -f /path/to/post.md --editor

The tool takes care of:

  • Creating the post if it’s new
  • Updating the post if it already exists
  • Uploading and rewriting image paths to proper Ghost URLs

There’s no runtime. No daemon. No need to open the CMS.

What You Get

  • Real version control Posts live in Git. You get git log, pull requests, inline diffs, CI checks.
  • Stateless deploys Posts can be published from anywhere. Just point to the Markdown file. Or automatically with CI/CD.
  • Front-matter is the truth Titles, tags, status, authors, descriptions—everything is stored right inside the Markdown file.
  • Smart images Use local paths. ghostpost uploads and rewrites them for you.
  • CI-ready Validate structure. Block merges on bad metadata. Push on deploy.

Here’s a basic example using GitHub Actions:

# .github/workflows/publish.yml
jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: ghostpost publish -f posts/hello-from-git.md --editor

Why Not Just Use the Ghost UI?

Because once you’ve versioned your posts, previewed with Markdown, and deployed with a single command—there’s no going back.

No clunky editors. No missing history. No surprises.

Get Started

Check out the repo and the readme at https://github.com/rodchristiansen/ghost-gitops-publishing

Install the binary, connect it to your Ghost API, and start treating your writing like the rest of your infrastructure: reproducible, testable, and versioned.