This directory contains the automated CI/CD pipeline for continuous integration, versioning, releases, and deployment.
Trigger: Push to main branch
Pipeline Flow:
Push to main
│
├── Job 1: Format and Lint Checks
│ ├── Check code formatting (Prettier)
│ └── Run linter (ESLint)
│ └── ✅ Must pass before continuing
│
├── Job 2: Create Version and Tag
│ ├── Analyze commit message
│ ├── Calculate new version (v1.0.0 → v1.0.1)
│ ├── Update package.json
│ ├── Create Git tag
│ └── Push tag to GitHub
│ └── ✅ Tag created
│
├── Job 3: Build and Deploy to Firebase
│ ├── Checkout code at new tag
│ ├── Build project
│ └── Deploy to Firebase Hosting with tag message
│ └── ✅ Live on Firebase
│
└── Job 4: Create GitHub Release
├── Build project for archives
├── Create source archive
├── Create build archive
├── Generate checksums
├── Generate release notes
└── Publish GitHub Release
└── ✅ Release published
graph TD
A[Format and Lint] --> B[Create Version and Tag]
B --> C[Build and Deploy to Firebase]
B --> D[Create GitHub Release]
C --> D
Jobs run in strict sequence to ensure:
- Code quality is verified first
- Version tag is created before deployment
- Firebase deployment uses the tagged version
- GitHub Release includes the deployed version
The version bump type is determined by your commit message prefix:
| Commit Prefix | Version Bump | Example | Result |
|---|---|---|---|
breaking: or major: |
MAJOR | v1.0.0 | → v2.0.0 |
feat: or feature: or minor: |
MINOR | v1.0.0 | → v1.1.0 |
All others (fix:, docs:, chore:, etc.) |
PATCH | v1.0.0 | → v1.0.1 |
# Patch release (v1.0.0 → v1.0.1)
git commit -m "fix: resolve authentication timeout issue"
git commit -m "docs: update setup guide"
git commit -m "chore: update dependencies"
# Minor release (v1.0.0 → v1.1.0)
git commit -m "feat: add dark mode toggle"
git commit -m "feature: implement user profile page"
# Major release (v1.0.0 → v2.0.0)
git commit -m "breaking: change authentication API structure"
git commit -m "major: migrate to Firebase v10"- ✅
npm run format:check- Ensures code is properly formatted - ✅
npm run lint- Checks for code quality issues - ❌ Pipeline stops if either fails
- Analyzes the latest commit message
- Determines bump type (major/minor/patch)
- Calculates new version using
bump-version.sh - Updates
package.jsonandpackage-lock.json - Creates Git tag (e.g.,
v1.0.1) - Pushes tag and version bump commit to GitHub
Output: New version tag (e.g., v1.0.1)
- Checks out code at the newly created tag
- Installs dependencies
- Builds the project (
npm run build) - Deploys to Firebase Hosting
- Deployment message includes the version tag
Output: Live deployment at Firebase Hosting with version tag
Creates and publishes a GitHub Release with:
Release Assets:
firebase-react-template-v1.0.1-source.tar.gz- Full source codefirebase-react-template-v1.0.1-build.tar.gz- Production buildchecksums.txt- SHA256 checksums
Release Notes:
- Version number and bump type
- List of commits since last release
- Firebase deployment confirmation
- Installation instructions
- Download links
Location: .github/scripts/bump-version.sh
Purpose: Calculate next semantic version based on bump type
Usage:
bash .github/scripts/bump-version.sh [major|minor|patch]Examples:
# Current tag: v1.2.3
bash .github/scripts/bump-version.sh patch
# Output: v1.2.4
bash .github/scripts/bump-version.sh minor
# Output: v1.3.0
bash .github/scripts/bump-version.sh major
# Output: v2.0.0The workflow requires these secrets to be configured:
| Secret Name | Description | How to Get |
|---|---|---|
FIREBASE_SERVICE_ACCOUNT |
Firebase service account JSON | Firebase Console → Project Settings → Service Accounts → Generate New Private Key |
FIREBASE_PROJECT_ID |
Your Firebase project ID | Firebase Console or .firebaserc file |
GITHUB_TOKEN |
Automatically provided by GitHub | No setup needed |
- Go to your GitHub repository
- Click Settings → Secrets and variables → Actions
- Click New repository secret
- Add each secret with the name and value
- Click Add secret
The workflow requires write permissions to:
- Create and push Git tags
- Update repository files (package.json)
- Create GitHub Releases
- Deploy to Firebase Hosting
- Go to Settings → Actions → General
- Under "Workflow permissions":
- Select Read and write permissions
- Check Allow GitHub Actions to create and approve pull requests
- Click Save
After a successful push to main, you should see:
- ✅ Green checkmark in GitHub Actions
- 🏷️ New Git tag in repository tags
- 📦 Updated package.json version
- 🚀 Live deployment on Firebase Hosting
- 📋 New GitHub Release with assets
Problem: Pipeline stops at Job 1
Solution:
# Fix formatting locally
npm run format
# Fix linting errors
npm run lint
# Commit and push
git add .
git commit -m "fix: resolve format and lint issues"
git pushProblem: Tag creation fails because tag already exists
Solution:
# Delete the tag locally and remotely
git tag -d v1.0.1
git push origin :refs/tags/v1.0.1
# Push again to recreate
git pushCommon Issues:
- Invalid service account: Verify
FIREBASE_SERVICE_ACCOUNTsecret - Wrong project ID: Check
FIREBASE_PROJECT_IDmatches your Firebase project - Build errors: Test
npm run buildlocally first
Problem: Build step fails
Solution:
# Test build locally
npm run build
# Check for errors in code
npm run lint
# Fix issues and push
git add .
git commit -m "fix: resolve build errors"
git pushProblem: GitHub Release creation fails
Solutions:
- Ensure build succeeded
- Check disk space
- Verify workflow permissions are set correctly
- Go to Actions tab in your repository
- Click on the latest workflow run
- View progress of each job:
- 🟡 Yellow: Job running
- 🟢 Green: Job succeeded
- 🔴 Red: Job failed
- Click on a job name to see detailed logs
- Expand each step to see output
- Red X indicates where failure occurred
You can manually trigger the workflow:
- Go to Actions tab
- Select CI/CD Pipeline workflow
- Click Run workflow
- Select branch (
main) - Click Run workflow button
Always use proper commit prefixes for correct versioning:
✅ Good
git commit -m "feat: add user authentication"
git commit -m "fix: resolve database connection issue"
❌ Bad
git commit -m "added feature"
git commit -m "bug fix"Before pushing to main:
npm run format:check # Check formatting
npm run lint # Check linting
npm run build # Test build
npm run preview # Preview buildAfter release is created:
- Check release notes on GitHub
- Verify download links work
- Test downloaded archives
- Check Firebase Console for deployment status
- Test the live site
- Verify version matches the tag
For detailed documentation, see: