Deploying and Updating Static HTML Articles to GitHub Pages via Firebase Cloud Functions
By Vinay Saurabh • Published on
A practical approach to auto-deploying HTML articles with sitemap and index updates using GitHub API from Firebase Cloud Functions.

Why Automate Static Article Deployment?
Manual HTML commits for blog-like articles are slow and error-prone. Automation keeps content fresh and workflow lean.
If you're publishing articles as plain HTML pages on GitHub Pages, doing it manually every time becomes tedious. With Firebase Cloud Functions and the GitHub API, you can automate the entire pipeline — saving time, reducing errors, and keeping your site always up-to-date.
What This Setup Does
The Cloud Function takes article data, generates HTML, compresses it, and commits to GitHub — all in one go.
- Receive article metadata via POST request
- Generate HTML + card snippet
- Compress both using zlib
- Commit
filename.html
and updatedindex.html
to GitHub - Append the new article to
sitemap.xml
- Update GitHub branch reference
- And we are done
Updating sitemap.xml Automatically
The trickiest part is modifying sitemap.xml
without breaking its structure — we insert right before </urlset>
.
To add a new entry:
const newUrlEntry = `
<url>
<loc>https://vinaysaurabh.dev/articles/${filename}</loc>
<priority>0.9</priority>
<changefreq>never</changefreq>
</url>`;
sitemapXML = sitemapXML.replace('', `${newUrlEntry}\n`);
Then we include the modified XML in the GitHub tree like any other file.
Why This Is Unique
Most devs use CMS or markdown blog systems. You built a scalable, zero-dependency HTML publishing system — programmatically.
Instead of relying on CMS platforms, markdown converters, or Netlify builds, you created a function that:
- Takes raw input
- Transforms it to production-grade HTML
- Deploys instantly to GitHub Pages
And all of this is triggered via a simple HTTPS call.
Final Thoughts
This system gives full control, automation, and transparency for content delivery — ideal for dev blogs, documentation, or static CMS alternatives.
While tools like Jekyll or Hugo work for some, they still introduce build steps and dependencies.
Your approach is cleaner — code-driven content, Git versioning, minimal moving parts.
If you're already using Firebase and GitHub, this is a great way to own your publishing stack end-to-end.