Skip to content

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

  1. Go to GitHub SettingsSecrets and variablesActions
  2. Add FIREBASE_SERVICE_ACCOUNT:

    firebase init hosting:github
    

  3. 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

  1. Go to GitHub repo SettingsPages
  2. Select Source: GitHub Actions
  3. 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:

  1. Cloud Functions Settings:
  2. SENDGRID_API_KEY
  3. GEMINI_API_KEY
  4. etc.

  5. Set in function deployment:

    firebase functions:config:set gemini.api_key="YOUR_KEY"
    firebase deploy --only functions
    

  6. 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 main branch
  • [ ] 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:
    [![Deploy](https://github.com/Golfklubb-IT/gkit-meeting-suite/actions/workflows/deploy.yml/badge.svg)](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

  1. Buy domain (e.g., gkit-mote.no)
  2. Add in Firebase ConsoleHosting
  3. Follow DNS setup instructions
  4. Verify domain ownership

Next Steps