← Articles 2300

CI/CD for web deployment

By Vinay Saurabh • Published on

A simple approach to deploying your websites using github and firebase hosting

CI/CD for web deployment

Introduction to CI/CD

Why continuous integration and deployment matters in modern web development.



Tools You Need

A minimal setup to get started with CI/CD for web deployment.



Project Structure

Organize your codebase for effective deployment.



my-project/
├── public/
│ └── index.html
├── .github/
│ └── workflows/
│ └── deploy.yml
└── firebase.json

Setting Up Firebase Hosting

Connect your project with Firebase for seamless hosting.


  1. Install Firebase CLI: npm install -g firebase-tools
  2. Login: firebase login
  3. Initialize: firebase init hosting
  4. Deploy manually: firebase deploy

Creating the GitHub Action

Write a workflow to deploy automatically on push to main branch.



name: Deploy to Firebase
on:
  push:
    branches: [main]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: npm install -g firebase-tools
      - run: firebase deploy --token=${{ secrets.FIREBASE_TOKEN }}

Setting Up Secrets

Securely store your Firebase token in GitHub.


  1. Generate a CI token: firebase login:ci
  2. Go to your GitHub repo → Settings → Secrets
  3. Add a new secret named FIREBASE_TOKEN

Final Thoughts

CI/CD brings peace of mind and speed to your workflow.