← Back to all posts
DevOps·5 min read

How This Blog Is Built: Astro, GitHub Pages, and CI/CD

A complete walkthrough of the stack, Microsoft Learn–inspired reading features, automated testing and linting pipeline, and GitHub workflow powering this blog.

Applies to:GitHub PagesGitHub ActionsAstro 7Node.js 24
#astro#github-pages#github-actions#devops#playwright#vitest#pagefind

Starting a technical blog does not require managing a database, paying for hosting, or maintaining a complex CMS. This site is a 100% static website built with Astro, stored in a public Git repository, verified by an automated 7-stage quality pipeline, and deployed for free on GitHub Pages.

The entire source code is open and available in the repository: JoelMiller74/JoelMiller74.github.io. If you want to build your own engineering blog or documentation portal, this post walks through every layer of the architecture and how all the pieces fit together.


Why Astro + GitHub Pages?#

When choosing a stack for a technical blog, three priorities mattered most:

  1. Authoring in Markdown and MDX: Posts live as plain text files in Git (src/content/blog/), reviewed and versioned just like code.
  2. Zero server maintenance and zero hosting cost: GitHub Pages serves static HTML, CSS, and optimized images globally over HTTPS at https://<username>.github.io/.
  3. Fast, modern developer experience: Astro ships zero JavaScript by default, validates frontmatter with TypeScript and Zod, optimizes images to WebP automatically, and supports rich Markdown/MDX extensions without heavy runtime frameworks.
flowchart TD
  subgraph Authoring["1. Authoring (Git)"]
    direction LR
    MD["Markdown / MDX Posts"]
    IMG["Brand & Post Assets"]
  end

  subgraph Build["2. Astro 7 Static Build"]
    direction LR
    ZOD["Zod Schema Validation"] --> PLUG["Remark / Rehype<br/>(Callouts, Mermaid, Anchors)"] --> EC["Expressive Code<br/>(Light/Dark Themes)"]
    OPT["Sharp Image Optimization<br/>(WebP)"]
  end

  subgraph Output["3. Static Output (dist/)"]
    direction LR
    HTML["Static HTML, CSS, RSS, Sitemap"] --> PF["Pagefind Search Index"]
  end

  subgraph Hosting["4. Hosting"]
    GHP["GitHub Pages (joelmiller74.github.io)"]
  end

  MD --> ZOD
  IMG --> OPT
  EC --> HTML
  OPT --> HTML
  PF --> GHP

Core Technology Stack#

Every tool in this repository was chosen to keep the site fast, maintainable, and dependency-light. You can inspect the full configuration in astro.config.mjs and package.json.

LayerTechnologyPurpose
Static Site GeneratorAstro 7 + @astrojs/mdxStatic HTML generation, Content Collections, MDX components
Markdown Pipeline@astrojs/markdown-remark (unified)Custom remark/rehype plugins without deprecated legacy hooks
Code Blocksastro-expressive-codeFile titles, diffs, terminal frames, Copy buttons, light/dark themes
Diagramsmermaid + custom remark pluginArchitecture and workflow diagrams authored directly in Markdown
SearchPagefindStatic full-text search index built into dist/pagefind/
CommentsGiscusGitHub Discussions–backed comments synced with light/dark mode
Syndication & SEO@astrojs/rss, @astrojs/sitemap, robots.txtAutomated RSS feed, XML sitemap, Open Graph metadata
Image OptimizationAstro <Image /> + sharpConverts PNG/JPG assets into sized WebP bundles at build time
Quality & TestingPrettier, ESLint, markdownlint-cli2, astro check, Vitest, PlaywrightFormatting, static analysis, unit tests, and headless Chromium E2E tests
CI/CD & HostingGitHub Actions + GitHub PagesAutomated verification on PRs and zero-touch deployment on main

Microsoft Learn–Inspired Reader Experience#

Because most of the content on this blog focuses on Microsoft Platforms (Data Platforms, AI, DevOps, and Architecture), the reading experience intentionally mirrors the most helpful patterns from Microsoft Learn:

1. Colored Callout Alerts#

A custom remark plugin (src/plugins/remark-callouts.mjs) transforms standard GitHub/Microsoft Learn blockquote tags into styled, theme-aware callouts with icons and optional custom titles:

  • > [!NOTE] / > [!INFO] — Azure Blue informational callout
  • > [!TIP] — Emerald Green best-practice tip
  • > [!IMPORTANT] — Violet key architectural requirement
  • > [!WARNING] — Amber caution or common pitfall
  • > [!DANGER] / > [!CAUTION] — Red destructive or high-risk alert

2. Multi-Tool <Tabs> and Numbered <Steps>#

In .mdx articles, lightweight zero-framework Astro components (Tabs.astro, TabItem.astro, and Steps.astro) let readers switch between tools—such as Azure CLI, PowerShell, and Bicep—while persisting their tab choice across the page via localStorage.

3. Diagrams-as-Code with Mermaid#

Instead of maintaining external PNGs that go stale, fenced ```mermaid blocks are converted by src/plugins/remark-mermaid.mjs into client-rendered SVGs that automatically re-theme when you toggle between Light and Dark mode.

4. Navigation, Metadata, and Discovery#

  • Sticky “On this page” TOC & # heading anchors: Generated from ## and ### headings with rehype-autolink-headings so readers can deep-link to any section.
  • “Applies to” metadata bar & “Edit this page on GitHub”: Articles can list target platforms via appliesTo in frontmatter, and every post includes a direct GitHub edit link in the right sidebar.
  • Guided Series & Prev/Next cards: Adding series and seriesOrder in frontmatter automatically links multi-part tutorials with a chapter list and Previous/Next navigation.
  • Click-to-zoom Image Lightbox: Clicking any screenshot or diagram inside a post opens a full-screen <dialog> preview (ImageLightbox.astro).
  • Collapsible <details> sections: Native HTML <details>/<summary> blocks are styled as expandable cards for troubleshooting steps or long outputs.
  • Static Full-Text Search (/search): Pagefind indexes <article data-pagefind-body> content and topic categories at build time with zero backend infrastructure.

Automated Linting, Formatting, and Testing#

Treating a blog like production software keeps formatting consistent and prevents broken Markdown, dead frontmatter, or JavaScript regressions from ever reaching readers.

Local Pre-Commit Guardrails#

Husky and lint-staged run automatically on every git commit (.husky/pre-commit):

  • JS / TS / Astro files: Auto-fixed with ESLint and formatted with Prettier.
  • CSS / JSON / YAML files: Formatted with Prettier.
  • Blog posts (src/content/blog/**/\*.{md,mdx}): Linted with markdownlint-cli2 and formatted with Prettier.

The Single Deterministic Command: npm run verify#

Rather than remembering six different test commands—or letting local checks drift from CI—scripts/verify.mjs exposes a single deterministic command (npm run verify) that runs 7 sequential stages and fails fast on the first error:

flowchart TD
  S1["1. Format Check<br/>Prettier (~1.5s)"] --> S2["2. Type & Template Check<br/>astro check (~10s)"]
  S2 --> S3["3. Code Lint<br/>ESLint + jsx-a11y (~3.5s)"]
  S3 --> S4["4. Markdown Lint<br/>markdownlint-cli2 (~1s)"]
  S4 --> S5["5. Unit Tests<br/>Vitest: 9 tests (~1s)"]
  S5 --> S6["6. Production Build + Search<br/>astro build + pagefind (~6.5s)"]
  S6 --> S7["7. E2E Smoke Tests<br/>Playwright Chromium (~2.5s)"]
  • Unit tests (tests/unit/, Vitest): Verify reading-time estimation, topic lookup helpers, and AST output from both custom remark plugins (remark-callouts and remark-mermaid).
  • E2E smoke tests (tests/e2e/smoke.spec.ts, Playwright): Launch headless Chromium against the actual built dist/ output to verify zero console errors, theme toggling and light/dark hero banner swapping, interactive <Tabs> switching, Image Lightbox open/close, and live Pagefind search results on /search.

For the full test inventory, expected outputs, and timing benchmarks, see docs/testing.md.


CI/CD Automation with GitHub Actions#

Deployment is fully automated by .github/workflows/deploy.yml using Node.js 24 and Node 24–native GitHub Actions (actions/checkout@v7, actions/setup-node@v7, actions/upload-pages-artifact@v5, and actions/deploy-pages@v5):

flowchart LR
  PR["Pull Request to main"] --> VERIFY["verify-and-build Job<br/>npm ci → Playwright Chromium → npm run verify"]
  PUSH["Push to main / Manual Dispatch"] --> VERIFY
  VERIFY -->|PR only| DONE["Checks Reported on PR<br/>(No Deployment)"]
  VERIFY -->|Push to main| UPLOAD["Upload ./dist Artifact"]
  UPLOAD --> DEPLOY["deploy Job<br/>Publish to GitHub Pages"]

Because the GitHub Actions workflow calls the exact same npm run verify script used locally:

  • Every pull request runs formatting, TypeScript checks, ESLint, Markdownlint, Vitest unit tests, Astro + Pagefind build, and Playwright Chromium smoke tests before merging.
  • Any failure blocks deployment automatically.
  • Merging or pushing to main publishes the verified dist/ bundle to GitHub Pages in about a minute.

How to Start Your Own Blog in Minutes#

Want to build a similar site for yourself? The easiest way is to fork JoelMiller74/JoelMiller74.github.io directly into your own GitHub account—naming the fork <your-username>.github.io so origin is already configured for your repository—or scaffold a fresh Astro starter from scratch:

Terminal window
# 1. Click "Fork" at https://github.com/JoelMiller74/JoelMiller74.github.io/fork
# and name your fork: <your-username>.github.io
# 2. Clone YOUR fork locally:
git clone https://github.com/<your-username>/<your-username>.github.io.git
cd <your-username>.github.io
npm install
npx playwright install chromium
npm run verify
Terminal window
npm create astro@latest my-blog -- --template blog
cd my-blog
npm run dev
  1. Fork the repository at JoelMiller74/JoelMiller74.github.io/fork and set the repository name to <your-username>.github.io (or create a new empty repo if starting fresh with Astro).

  2. Clone your fork locally, install dependencies, and run the interactive reset wizard (npm run reset-site) to clear existing posts, swap in generic placeholder brand images, and populate your name, GitHub handle, and bio.

  3. Run npm run verify to confirm all 7 checks pass with your new settings, then replace the generic images in src/assets/brand/ with your own artwork.

  4. Enable GitHub Pages in your forked repository under Settings → Pages → Build and deployment → Source and select GitHub Actions.

  5. Push to main—GitHub Actions runs npm run verify and publishes your blog to https://<your-username>.github.io/ automatically.

Explore the repository documentation and key files

Discussion

Comments powered by Giscus — Enable GitHub Discussions on JoelMiller74/JoelMiller74.github.io, generate your IDs at giscus.app, and paste repoId and categoryId into src/consts.ts to activate comments here.