Infrastructure · CI/CD · SEO

The Publishing Pipeline: from git push to Google, Hands-Off

How I built a pipeline where I only write the HTML and the rest — deploy, domain, privacy, SEO and indexing — happens on its own. With the architecture layer by layer and the real bugs that showed up along the way.

The Problem

I wanted to publish technical papers on a personal domain. The easy part is writing. The annoying part is everything around it: uploading the file, configuring the domain, ensuring HTTPS, generating sitemap.xml and robots.txt, telling Google a new page exists — and, in my case, making sure nothing private leaks to the public surface, since the repo holds internal context.

Doing this by hand on every paper is the perfect recipe for giving up on the third one. So I turned the repetitive work into a pipeline: a single gesture — git push — triggers everything else. This paper documents that pipeline, layer by layer, the way I wish I'd found it written when I started.

The principle that guided the design: I only write the content (one HTML file). Deploy, domain, privacy, SEO and indexing are the machine's job. Every decision below serves that.

Pipeline Overview

Five pieces connect to each other. The git push triggers two in parallel (Vercel and GitHub Actions); the other three were configured once and sit in the path of the request or of Google's crawler:

The non-obvious point: deploy and SEO are separate rails. Vercel handles serving the site; GitHub Actions handles privacy and SEO. They don't depend on each other — if the sitemap fails, the site still ships; if the privacy guard fails, the merge is blocked before anything goes live.

Layer 1 — Automatic Deploy with Vercel

Vercel watches the GitHub repo. On every push it builds and deploys. Since the site is plain HTML (no framework, no build step), the config is minimal — but one detail saves a lot of pain: the Root Directory.

Root Directory = papers/

The repo is a monorepo: it has skills, internal docs, scripts and the papers/ folder. I do not want Vercel serving the whole repo — only the papers. By pointing Root Directory at papers/, Vercel treats that folder as the site root. Everything outside it simply doesn't exist to the world. That's the first line of privacy defense, even before CI.

The Vercel bot on the Pull Request

This was the piece that helped me most day to day. When I open a PR, the Vercel bot automatically comments with a preview URL: an isolated deploy of that branch, looking exactly like the paper will in production. I review the rendered paper before merging — without pushing anything to the real domain. When the PR is merged into main, Vercel promotes that same build to production.

Mental flow: branch → PR → bot preview → review → merge → production. I never edit directly on main. This isn't just good practice — the repo's security policy blocks direct pushes to main, so the PR path is mandatory anyway.

Clean URLs: vercel.json

A small config file inside papers/ controls two URL behaviors and one redirect:

{
  "cleanUrls": true,
  "trailingSlash": false,
  "redirects": [
    {
      "source": "/2026-06-05-harness-study",
      "destination": "/harness-study",
      "permanent": true
    }
  ]
}

Layer 2 — Domain and DNS on Cloudflare

The papers live on a subdomain (papers.YOUR-DOMAIN.dev), separate from the main personal site. This keeps the two projects independent on Vercel and gives a short, thematic URL.

DNS is on Cloudflare. The configuration is a single record:

Tipo:    CNAME
Nome:    papers
Destino: cname.vercel-dns.com
Proxy:   DNS only (nuvem cinza, não laranja)

The gotcha that costs hours: leaving Cloudflare's proxy on (orange cloud). When on, Cloudflare intercepts the traffic and tries to manage the SSL certificate — which conflicts with Vercel's certificate issuance and breaks HTTPS. The fix is DNS only (grey cloud): Cloudflare just resolves the name and lets Vercel handle SSL.

On the Vercel side, you add the custom domain to the project (Settings → Domains). Vercel detects the CNAME, issues the certificate, and the subdomain starts serving the papers with automatic HTTPS and automatic renewal.

Layer 3 — Privacy Guard in CI

The repo is private and holds internal context — names, institution, company. The papers are public. The risk is obvious: one day I paste a snippet into a paper without noticing a proper name is in it. The defense is a script that fails the build if any forbidden term shows up in the papers/ folder.

The terms live in a separate text file (one per line), decoupled from the script logic:

# scripts/forbidden-terms.txt
# Um termo por linha. # = comentário. Case-insensitive.
NomeDaEmpresa
SiglaDaFaculdade
MinhaCidade

The heart of privacy-guard.sh is a recursive, literal, case-insensitive grep (-rinIF) over papers/. If it finds any term, it prints exactly where it leaked and exits with an error code:

while IFS= read -r term || [ -n "$term" ]; do
  [ -z "${term//[[:space:]]/}" ] && continue   # ignora linha vazia
  case "$term" in \#*) continue ;; esac        # ignora comentario

  if grep -rinIF -- "$term" "$TARGET" >/dev/null 2>&1; then
    echo "❌ LEAK: termo proibido '$term' encontrado em $TARGET/:"
    grep -rinIF -- "$term" "$TARGET" | sed 's/^/   /'
    found=1
  fi
done < "$TERMS_FILE"

[ "$found" -ne 0 ] && exit 1   # build falha → merge bloqueado

A deliberate detail: my public GitHub handle is not in the forbidden terms list. It shows up in the papers' footer on purpose. The list protects only what must stay private — it's not a blind filter, it's a chosen boundary. This is the "private source, public surface" model: the repo knows everything, the site shows only what's allowed.

This step runs on every event of the workflow — push and pull request. Because it runs on the PR, a leak is caught before merge, before any deploy. The guard is the first thing CI executes.

Layer 4 — Automatic SEO: a Git-Derived Sitemap

For Google to index well, the site needs sitemap.xml, robots.txt and an index page listing the papers. Keeping that by hand on every paper is exactly the kind of repetitive work the pipeline should eliminate. build-sitemap.sh generates all three from whatever files exist in papers/.

Dates come from git, not from the filename

This is the design decision I like most. The paper slug has no date (/harness-study, not /2026-06-05-harness-study) — the URL is evergreen. But the sitemap needs a modification date (lastmod). Where does it come from? From git history:

# publicado = primeiro commit do arquivo; atualizado = ultimo commit
# --follow sobrevive a renomeacoes do arquivo
git_first_date() { git log --follow --format=%cs -- "$1" | tail -1; }
git_last_date()  { git log --follow -1 --format=%cs -- "$1"; }

Result: the date never lies. When I edit a paper, lastmod bumps itself on the next push, because it comes from the real commit. The URL stays the same, the content evolves, and Google knows the page was updated. None of it requires me to remember to touch a date.

Absolute URL, or Google rejects it

The domain comes from the SITE_URL variable (set on GitHub under Settings → Secrets and variables → Actions → Variables). Google rejects sitemaps with <loc> lacking a protocol, so the script forces https:// if it's missing:

SITE_URL="${SITE_URL%/}"            # tira barra final
case "$SITE_URL" in
  http://*|https://*) ;;            # ja tem protocolo
  *) SITE_URL="https://$SITE_URL" ;;  # forca https
esac

That three-line case exists because I got bitten by it in production (more on that in the bugs section). The script generates each paper's <loc>, the robots.txt pointing to the sitemap, and an index.html listing the papers newest-first — all ordered by the git-derived publication date.

Layer 5 — The Workflow That Glues It Together

GitHub Actions ties the privacy guard and the SEO generation into a single job. The logic of when each step runs is what makes the pipeline safe without being annoying:

- name: Privacy guard (falha se vazar)
  run: bash scripts/privacy-guard.sh papers

- name: Gerar sitemap + robots
  if: github.event_name == 'push'
  env:
    SITE_URL: ${{ vars.SITE_URL }}
  run: bash scripts/build-sitemap.sh

- name: Commitar sitemap se mudou
  if: github.event_name == 'push'
  run: |
    git add papers/sitemap.xml papers/robots.txt
    if git diff --cached --quiet; then
      echo "Sitemap sem mudancas — nada a commitar."
    else
      git commit -m "chore(papers): regenera sitemap e robots [skip ci]"
      git push
    fi

Two final details: permissions: contents: write grants the bot the right to commit back; and concurrency with cancel-in-progress ensures that, if I push two quick commits, only the last one runs — no race between two sitemaps.

Layer 6 — Google Search Console

The last piece is manual, but only once. In Google Search Console, you add the property (https://papers.YOUR-DOMAIN.dev/) and verify ownership — usually via a DNS record on Cloudflare. Once verified, you submit the sitemap:

https://papers.SEU-DOMINIO.dev/sitemap.xml

A detail that tripped me up: GSC wants the full URL of the sitemap, not just sitemap.xml. And the property must be verified first. After that, indexing is asynchronous — it takes hours to days, and the dashboard shows "Data is being processed" at first. Patience is part of it.

From then on, the loop closes itself: each new paper enters the sitemap via CI, Google re-reads the sitemap periodically and discovers new pages without me resubmitting anything.

The Real Bugs (and how I fixed them)

The pipeline wasn't born finished. I document the stumbles because they're exactly what I'd re-forget — and rereading this is the best spaced repetition there is.

  1. 404 at the domain root Vercel served /harness-study, but / gave a 404 — there was no index.html in papers/. Fix: build-sitemap.sh now also generates an index.html listing the papers. The root became the showcase.
  2. "Invalid URL" in the sitemap (GSC) The SITE_URL lacked https://, so <loc> came out protocol-less and Google refused it. Fix: the case that forces https:// in the script — now it's impossible to generate an invalid sitemap, even if I misconfigure the variable.
  3. Direct push to main blocked The repo's security policy refuses direct pushes to main. Fix: I embraced the branch + PR flow — which, as a bonus, gives me the Vercel bot preview to review before merging. The constraint became a better habit.
  4. CI ran with the wrong variable at the wrong time A merge triggered CI before I'd fixed SITE_URL, producing a bad sitemap. Fix: I regenerated manually and committed; and since the script now fixes the protocol on its own, that timing can't bite anymore.

Design Decisions

Decision Why
Root Directory = papers/ Only the papers ship; the rest of the monorepo is never served. Privacy by construction.
Deploy and SEO on separate rails Vercel serves; Actions guards and indexes. One failing doesn't take down the other.
Dates from git, not in the slug Evergreen URL; lastmod bumps itself on edit. The date never lies.
Forbidden terms in a separate file Edit the privacy boundary without touching the script logic.
[skip ci] on the auto-commit Avoids the infinite loop of CI committing and triggering itself.
DNS only on Cloudflare Leaves SSL to Vercel; the orange proxy would break the certificate.

What I Learned

The takeaway: a good pipeline isn't the one that automates the most things, it's the one that reduces the human gesture to a single conscious decision. In the end, writing a paper is just writing an HTML file and opening a PR. Privacy, deploy, domain, SEO and indexing aren't a checklist of mine — they're properties guaranteed by the machine. Each bug I documented became a guarantee in the code, not a mental note I'd forget.

Next Steps