Deploying¶
🚀 Firebase Hosting Deployment¶
Manual Deploy¶
# 1. Build for production
npm run build
# 2. Deploy to Firebase Hosting
firebase deploy --only hosting
URL: https://gkit-meeting-suite.web.app
Deploy Firestore Rules¶
firebase deploy --only firestore:rules
Deploy Cloud Functions¶
firebase deploy --only functions
Deploy Everything¶
firebase deploy
🔄 GitHub Actions CI/CD¶
Create Workflow File¶
Create .github/workflows/deploy.yml:
name: Deploy to Firebase
on:
push:
branches: [main]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Deploy to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
channelId: live
projectId: gkit-meeting-suite
Setup GitHub Secrets¶
- Go to GitHub Settings → Secrets and variables → Actions
-
Add
FIREBASE_SERVICE_ACCOUNT:firebase init hosting:github -
This creates the secret automatically
Deploy on Every Push¶
After setup, every push to main auto-deploys:
git add .
git commit -m "feat: new feature"
git push origin main
# Auto-deploy starts via GitHub Actions
📚 GitHub Pages Documentation¶
Enable GitHub Pages¶
- Go to GitHub repo Settings → Pages
- Select Source:
GitHub Actions - GitHub will auto-detect
mkdocs.yml
Build & Deploy Docs¶
Create .github/workflows/docs.yml:
name: Deploy Docs
on:
push:
branches: [main]
paths:
- 'docs/**'
- 'mkdocs.yml'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install mkdocs
run: |
pip install mkdocs mkdocs-material
- name: Build docs
run: mkdocs build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
Documentation URL: https://golfklubb-it.github.io/gkit-meeting-suite/
🧪 Testing Before Deploy¶
Type Checking¶
npx tsc --noEmit
Build Locally¶
npm run build
npm run preview # Preview on http://localhost:4173
Test Firestore Rules¶
firebase emulators:start --only firestore
# Run unit tests against emulator
🔐 Environment Variables in Deployment¶
Production Secrets¶
Store sensitive values in Firebase Console:
- Cloud Functions Settings:
SENDGRID_API_KEYGEMINI_API_KEY-
etc.
-
Set in function deployment:
firebase functions:config:set gemini.api_key="YOUR_KEY" firebase deploy --only functions -
Access in functions:
const functions = require('firebase-functions'); const apiKey = functions.config().gemini.api_key;
Public Variables (Safe in .env.local)¶
Only Firebase SDK config (no secrets):
VITE_FIREBASE_API_KEY=... # Public, can be exposed
VITE_FIREBASE_PROJECT_ID=... # Public
🔄 Deployment Checklist¶
- [ ] Tests pass (
npm run build) - [ ] TypeScript errors fixed (
npx tsc --noEmit) - [ ] Firestore rules reviewed
- [ ] Environment variables set
- [ ] Commit message clear
- [ ] PR approved (if using)
- [ ] Push to
mainbranch - [ ] Verify on https://gkit-meeting-suite.web.app
- [ ] Check GitHub Actions logs
📊 Monitoring¶
Firebase Console¶
- Realtime Database: Usage, reads/writes
- Cloud Functions: Logs, performance
- Hosting: Traffic, bandwidth
GitHub Actions¶
- View deployment logs: Actions tab in repo
- Status badge in README:
[](https://github.com/Golfklubb-IT/gkit-meeting-suite/actions)
🚨 Rollback¶
If deployment breaks production:
# View previous versions
firebase hosting:channels:list
# Deploy previous version
firebase hosting:clone-version SOURCE_CHANNEL LIVE
Or revert commit:
git revert HEAD
git push origin main
🌍 Custom Domain¶
- Buy domain (e.g., gkit-mote.no)
- Add in Firebase Console → Hosting
- Follow DNS setup instructions
- Verify domain ownership
Next Steps¶
- See Development for local setup
- See Configuration for env vars