Urgent.News

What's breaking now, across thousands of outlets.

Tech

Automating Multi‑Channel Content Publishing with a Single Repo‑Based Generator

Automating Multi‑Channel Content Publishing with a Single Repo‑Based Generator TL;DR: I refactored the content-automation repo to generate platform‑specific markdown/JSON files in one CI step, fixing broken metadata flags and eliminating per‑run credential churn. The change now lets our GitHub Action push to Medium, Substack, and Bluesky reliably from a single source of truth. The Problem Our…

The author sought to streamline multi-channel content publishing by consolidating three separate scripts into a single generator. The original scripts duplicated logic for extracting front-matter and updating metadata.json, leading to race conditions and credential churn issues.

To address these problems, the author created src/generator.ts, a Node module that centralizes content generation. This single module reads the source markdown once, constructs a unified content model, and writes platform-specific markdown, JSON, and other files in one CI step.

The generateAll() function in src/generator.ts takes the source path, reads the markdown file, parses it into a data object using gray-matter, and builds a Content model instance with title, body, tags, and date properties. It then calls platform-specific builder functions (buildMedium, buildSubstack, buildBluesky) with this model to generate the appropriate files in the content/2026/10/08/content-automation directory.

Key changes included writing metadata.json atomically at the end of generation, eliminating per-run credential churn by initializing the API client only once, and eliminating race conditions by reading and writing the metadata file sequentially within generateAll(). This refactor enabled reliable, single-step publishing to Medium, Substack, and Bluesky from a single source of truth.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Saturday 10 October →