Firebase Hosting Deployment
Firebase Hosting serves docmd static sites over Google’s global CDN infrastructure with automated SSL certificate provisioning.
Initial Setup & CLI Tools
Install Firebase CLI tools:
npm install -g firebase-tools
firebase login
Initialisation Steps
- Compile your site:
npx @docmd/core build - Initialise Firebase Hosting configuration:
Select parameters when prompted:firebase init hosting- Public directory:
site - Single-page app rewrite:
No(docmd compiles individualindex.htmlpages). - Overwrite
site/index.html:No
- Public directory:
- Deploy assets:
firebase deploy --only hosting
GitHub Actions CI/CD Integration
To automate publishing on push to main, create .github/workflows/firebase.yml:
.github/workflows/firebase.yml
name: Deploy to Firebase Hosting
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install
- run: npx @docmd/core build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
channelId: live
Store FIREBASE_SERVICE_ACCOUNT in your repository under Settings → Secrets and variables → Actions.
Custom Domain Mapping
Add custom domains in the Firebase Console under Hosting → Custom domain. Update the url property in docmd.config.json to match your domain so sitemaps and open graph metadata generate correctly.