Self-Publishing Pipeline for Static Blogs

Tired of PR merges at dawn? This dev's static site pipeline schedules posts automatically, previews drafts securely, and laughs at database woes.

No More Desk-Bound Blog Merges — theAIcatchup

Key Takeaways

  • Use date-filtered Vite glob imports for smoothly post scheduling in static sites.
  • GitHub Actions cron is 'best effort'—great for blogs, unreliable for timed launches.
  • Nix Flakes boost reproducibility, but test for runner-specific bugs like glibc quirks.

No desk required.

That’s the quiet revolution in this self-publishing pipeline—a setup that lets posts bloom on schedule, without you babysitting a keyboard at merge time. Picture it: you draft in Markdown, slap on a future date, push to a private repo, and… done. GitHub Actions handles the midnight rebuild, filtering out anything not yet ripe. It’s Vite’s import.meta.glob at the core, paired with MDsveX turning posts into Svelte components, all sifted through a simple date check in src/lib/posts.ts.

But here’s the raw code heart:

const now = new Date().getTime(); // … inside the loop … const isVisible = !post.metadata.hidden && postDate <= now; if (showDrafts || isVisible) { // include the post }

Clever, right? Future posts lurk in the repo—hidden from production HTML—but visible if your repo stays private. Open-source it? You’d shuffle drafts to a branch. For now, it’s a personal hack that feels cheekily effective.

Why Ditch Databases for This Self-Publishing Pipeline?

Static sites scream speed—no 3 AM database meltdowns, just pure HTML bliss. Yet they’ve always demanded that “manual transmission” grind: sit down, merge, build, deploy. Scheduling? A pipe dream unless you’re scripting cron jobs on a VPS. This pipeline flips it. Nightly GitHub Actions cron—‘0 0 * * *’—triggers rebuilds, baking in only visible posts. No servers to wrangle. It’s the indie dev’s dream: write once, automate forever.

And.

GitHub’s cron? More suggestion than ironclad rule.

Here’s the thing no one tells you: GitHub’s schedule is more of a suggestion than a command. I’ve seen my “midnight” builds trigger at 1:45 AM or even 3 AM depending on how busy their runners are.

For a blog, it’s golden—“you get what you pay for,” as the author quips. Precision launch? Rent a runner or bail. This unreliability echoes early Unix crons, those 1970s workhorses that promised automation but delivered “best effort.” My unique spin: we’re not evolving past that architectural tension; free tiers just repackage it for the GitHub era. Bold prediction—indie hackers will flock to paid runners, birthing a micro-economy of $5/night deploy slots.

Nix Flakes lock the build env tight. No more “works on my machine” nightmares. deploy.yml dives into nix develop, pinning pnpm and Node versions. Assumed fix-all? Nope. A remark plugin bombed on Linux runners—glibc quirks biting back. Nix nails 95% reproducibility; that last 5%? Saturday’s curse.

Short para punch: Tradeoffs everywhere.

How Does Preview Mode Sneak in Drafts?

?preview=secret in the query string. SvelteKit’s RequestHandler sniffs it, bypasses date filters if tokens match.

export const GET: RequestHandler = async ({ url }) => { const previewToken = url.searchParams.get(‘preview’); const isPreview = previewToken === process.env.PREVIEW_TOKEN; const posts = importPosts(isPreview); return json(posts); };

Frictionless for Cloudflare Workers hosting—no dev server spins, no preview branches. Better than Vercel/Netlify previews? For this stack, yeah. It’s the ‘how’ that shines: shared secrets over branches mean one repo rules all, drafts peekable from phone browsers. Underlying shift? Static sites shedding “static” limits, inching toward dynamic lite without the bloat.

Look, corporate CMS giants hype “zero-ops publishing,” but they’re database traps in disguise. This? Pure open-source grit—Vite, SvelteKit, MDsveX, Nix. Skeptical eye: author’s private repo reliance screams scalability hack, not enterprise-ready. Still, for solopreneurs, it’s liberation.

We’ve wandered the pipeline: glob imports, date gates, cron whims, Nix shields, token previews. Deployment anxiety? Vanished. Write, date, push—trust the bots.

But why does this matter beyond one blog?

It’s architectural rebellion. Static generators like Astro or Next.js static export chase similar tricks, but this Svelte setup exposes the guts. No hype—GitHub’s flakiness calls out free-tool limits. Prediction: tools like this spawn “schedule-as-code” plugins, normalizing blog ops like CI/CD normalized apps.

Is GitHub Actions Cron Reliable for Scheduled Posts?

Nope, not for the punctual. Delays hit 3 AM. Fine for blogs, dicey for events. Alternatives? Self-hosted runners or Vercel cron (paid). Author’s take: good enough. Mine? Pair with webhooks for on-demand precision.

Why Use Nix Flakes in Your Deploy Pipeline?

Reproducibility. Exact local env on CI. But glibc gotchas lurk—test on Linux early. 95% win, worth the learning curve.

The voice here—skeptical yet admiring—nails open-source truth: elegant hacks hide gritty fixes. This pipeline’s no silver bullet, but damn if it doesn’t free the writer.


🧬 Related Insights

Frequently Asked Questions

What is a self-publishing pipeline for static blogs?

It’s an automated flow using static generators, cron jobs, and filters to schedule and deploy Markdown posts without manual intervention—think GitHub Actions rebuilding nightly.

How to schedule posts on SvelteKit static sites?

Filter imports with date metadata vs. current time in Vite glob, trigger builds via cron; add preview tokens for drafts.

Does Nix fix all CI environment issues?

95% yes—pins versions perfectly—but platform diffs like glibc can still snag plugins; debug cross-OS early.

Sarah Chen
Written by

AI research editor covering LLMs, benchmarks, and the race between frontier labs. Previously at MIT CSAIL.

Frequently asked questions

What is a self-publishing pipeline for static blogs?
It's an automated flow using static generators, cron jobs, and filters to schedule and deploy Markdown posts without manual intervention—think GitHub Actions rebuilding nightly.
How to schedule posts on SvelteKit static sites?
Filter imports with date metadata vs. current time in Vite glob, trigger builds via cron; add preview tokens for drafts.
Does Nix fix all CI environment issues?
95% yes—pins versions perfectly—but platform diffs like glibc can still snag plugins; debug cross-OS early.

Worth sharing?

Get the best AI stories of the week in your inbox — no noise, no spam.

Originally reported by Dev.to

Stay in the loop

The week's most important stories from theAIcatchup, delivered once a week.