Skip to content

Publish Blog Post

Publish Blog Post #21

Workflow file for this run

name: Publish Blog Post
on:
push:
branches:
- main
paths:
- 'content/blog/**.md'
workflow_dispatch:
inputs:
post_path:
description: "Override: cross-post a specific file (e.g. content/blog/2026-04-25-devops-matters-more-when-ai-writes-code.md)"
required: false
type: string
jobs:
microblog-crosspost:
runs-on: ubuntu-latest
# Kill switch — set the repo variable MICROBLOG_CROSSPOST_ENABLED=true to enable.
# Disable cross-posting by unsetting it.
if: ${{ vars.MICROBLOG_CROSSPOST_ENABLED == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Find new/changed blog post
id: post
run: |
if [ -n "${{ inputs.post_path }}" ]; then
CHANGED="${{ inputs.post_path }}"
echo "Using manual override: ${CHANGED}"
else
CHANGED=$(git diff --name-only HEAD~1 HEAD -- 'content/blog/*.md' \
| grep -v '\.gitkeep' | head -1)
echo "Found: ${CHANGED}"
fi
echo "path=${CHANGED}" >> $GITHUB_OUTPUT
- name: Setup Node.js
if: steps.post.outputs.path != ''
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: apps/editorial-loop/package-lock.json
- name: Install dependencies
if: steps.post.outputs.path != ''
run: npm ci --prefix apps/editorial-loop
- name: Generate micro.blog note + publish
if: steps.post.outputs.path != ''
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
MICROBLOG_APP_TOKEN: ${{ secrets.MICROBLOG_APP_TOKEN }}
MICROBLOG_DESTINATION_UID: ${{ vars.MICROBLOG_DESTINATION_UID }}
# Comma-separated UIDs from GET /micropub?q=syndicate-to (linkedin, mastodon, bluesky, threads).
# Defaults to 'linkedin' if the repo variable is unset.
MICROBLOG_SYNDICATE_TO: ${{ vars.MICROBLOG_SYNDICATE_TO || 'linkedin' }}
POST_PATH: ${{ steps.post.outputs.path }}
BASE_URL: https://doughatcher.com
run: node apps/editorial-loop/publish.js
- name: Summary
if: steps.post.outputs.path != ''
run: |
echo "## micro.blog Cross-Post" >> $GITHUB_STEP_SUMMARY
echo "Post: \`${{ steps.post.outputs.path }}\`" >> $GITHUB_STEP_SUMMARY
echo "Published at: $(date -u '+%Y-%m-%d %H:%M UTC')" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Micro.blog will syndicate to any cross-post destinations (LinkedIn, etc.) configured on the account." >> $GITHUB_STEP_SUMMARY