Skip to content

Complete Workflow Guide - Step by Step

🎯 Overview of the Workflow

Feature Branch β†’ Pull Request β†’ Preview URL β†’ Code Review β†’ Develop (Staging) β†’ Main (Production)

πŸ“‹ Table of Contents

  1. Initial Setup
  2. Daily Development Workflow
  3. Creating Features
  4. Testing on Preview URLs
  5. Deploying to Staging
  6. Deploying to Production
  7. Emergency Hotfixes
  8. Common Scenarios

πŸš€ Initial Setup

First Time Only - Create Develop Branch

Terminal window
# Run the setup script
cd /Users/larryanglin/Projects/HelpDesk
./scripts/setup-develop-branch.sh

Configure Branch Protection

  1. Go to https://github.com/LarryAnglin/HelpDesk/settings/branches
  2. Add protection rules for main and develop branches
  3. See BRANCH_PROTECTION_SETUP.md for detailed settings

πŸ’» Daily Development Workflow

Starting Your Day

Terminal window
# Always start by updating your local develop branch
git checkout develop
git pull origin develop

Creating a New Feature

Step 1: Create Feature Branch

Terminal window
# Create a new feature branch from develop
git checkout -b feature/add-user-export
# For bug fixes
git checkout -b fix/ticket-loading-error
# For updates
git checkout -b update/improve-ui-colors

Step 2: Make Your Changes

Terminal window
# Work on your feature
cd react
npm run dev
# Make changes to files
# Test locally at http://localhost:5173

Step 3: Commit Your Changes

Terminal window
# Check what you've changed
git status
# Add files
git add .
# Or add specific files
git add react/src/components/NewComponent.tsx
# Commit with descriptive message
git commit -m "Add user export functionality to admin panel
- Add export button to user list
- Implement CSV export function
- Add date range filter for exports"

Step 4: Push to GitHub

Terminal window
# First push
git push -u origin feature/add-user-export
# Subsequent pushes
git push

πŸ”— Creating a Pull Request

Step 1: Go to GitHub

After pushing, GitHub will show a banner:

  • Click β€œCompare & pull request”

Or manually:

  1. Go to https://github.com/LarryAnglin/HelpDesk
  2. Click β€œPull requests”
  3. Click β€œNew pull request”

Step 2: Fill Out PR Template

## Description
Added user export functionality to allow admins to download user data as CSV
## Type of Change
- [x] ✨ New feature (non-breaking change which adds functionality)
## Testing
- [x] Tested locally
- [ ] Tested on preview URL (will do after PR creation)
- [ ] Tested on staging
## Screenshots
[Add screenshot of export button]

Step 3: Create the PR

  1. Base branch: develop (NOT main!)
  2. Compare branch: feature/add-user-export
  3. Click β€œCreate pull request”

Step 4: Wait for Preview URL

Within 2-3 minutes, a bot will comment:

πŸ”₯ Preview deployed to: https://your-project-id--pr-42.web.app

πŸ§ͺ Testing on Preview URLs

Finding Your Preview URL

  1. Check the PR comments for the preview URL
  2. Or go to Actions tab β†’ Click your workflow β†’ Find the URL in logs

Testing Checklist

- [ ] Feature works as expected
- [ ] No console errors
- [ ] Mobile responsive
- [ ] Cross-browser testing
- [ ] Share with stakeholders for feedback

Updating After Feedback

Terminal window
# Make requested changes
git add .
git commit -m "Address PR feedback - improve error handling"
git push
# Preview URL auto-updates!

πŸ“¦ Deploying to Staging

After PR Approval

  1. Click β€œMerge pull request” on GitHub
  2. Choose β€œSquash and merge” (recommended)
  3. Edit commit message if needed
  4. Click β€œConfirm merge”

Automatic Staging Deployment

Testing on Staging

Staging Testing Checklist:
- [ ] All features work correctly
- [ ] No integration issues
- [ ] Performance is acceptable
- [ ] Error handling works
- [ ] Data persistence works

πŸš€ Deploying to Production

Creating a Production PR

Terminal window
# Ensure develop is up to date
git checkout develop
git pull origin develop
# Create PR from develop to main
# Do this on GitHub:
  1. Go to https://github.com/LarryAnglin/HelpDesk
  2. Click β€œNew pull request”
  3. Base: main ← Compare: develop
  4. Title: β€œRelease: v1.2.0 - User Export Feature”

Production PR Description

## Release v1.2.0
### Features
- Add user export functionality (#42)
- Improve UI responsiveness (#43)
### Bug Fixes
- Fix ticket loading error (#44)
### Tested
- [x] All features tested on staging
- [x] No breaking changes
- [x] Ready for production

Deploying

  1. Get approval (required by branch protection)
  2. Click β€œMerge pull request”
  3. Production deploys automatically
  4. Monitor at: https://your-project-id.web.app

🚨 Emergency Hotfixes

For Critical Production Bugs

Terminal window
# Create hotfix from main (not develop!)
git checkout main
git pull origin main
git checkout -b hotfix/critical-auth-bug
# Make minimal fix
git add .
git commit -m "Fix critical authentication bug"
git push -u origin hotfix/critical-auth-bug

Hotfix PR Process

  1. Create PR: hotfix/critical-auth-bug β†’ main
  2. Mark as urgent in PR description
  3. Get expedited review
  4. Merge to main
  5. Important: Also merge to develop!
Terminal window
# After hotfix is in production
git checkout develop
git pull origin develop
git merge main
git push origin develop

πŸ“– Common Scenarios

Scenario 1: Working on Multiple Features

Terminal window
# Feature 1
git checkout develop
git checkout -b feature/feature-1
# work and push
# Feature 2 (while feature 1 is in review)
git checkout develop # Always branch from develop!
git checkout -b feature/feature-2
# work and push

Scenario 2: Updating Your Branch

Terminal window
# If develop has new changes while you're working
git checkout develop
git pull origin develop
git checkout feature/my-feature
git merge develop
# Resolve conflicts if any
git push

Scenario 3: Abandoning a Feature

Terminal window
# Delete local branch
git checkout develop
git branch -D feature/abandoned-feature
# Delete remote branch
git push origin --delete feature/abandoned-feature

Scenario 4: Cherry-picking a Single Commit

Terminal window
# If you need just one commit from a feature
git checkout develop
git cherry-pick <commit-hash>
git push

🎯 Best Practices

Commit Messages

Terminal window
# Good
git commit -m "Add CSV export for user data with date filtering"
# Bad
git commit -m "Update files"

Branch Names

Terminal window
# Good
feature/add-user-export
fix/login-error-handling
update/react-dependencies
# Bad
feature/stuff
my-branch
test123

PR Sizes

  • Ideal: 200-400 lines changed
  • Maximum: 1000 lines
  • If larger: Split into multiple PRs

Review Process

  1. Self-review before requesting others
  2. Respond to all feedback
  3. Test the preview URL
  4. Approve only after testing

πŸ” Checking Deployment Status

View All Environments

Terminal window
# See all Firebase hosting channels
firebase hosting:channel:list

Check Current Deployments

Monitor GitHub Actions

  1. Go to https://github.com/LarryAnglin/HelpDesk/actions
  2. Click on the latest workflow
  3. Watch real-time logs

πŸ†˜ Troubleshooting

Preview URL Not Working

Terminal window
# Check if build passed
# Go to Actions tab β†’ Check for errors
# Common fixes:
npm install # Update dependencies
npm run build # Test build locally

Merge Conflicts

Terminal window
# Update your branch
git checkout feature/my-feature
git merge develop
# Resolve conflicts in VS Code
# Then:
git add .
git commit -m "Resolve merge conflicts with develop"
git push

Deployment Failed

  1. Check GitHub Actions logs
  2. Common issues:
    • Missing environment variables
    • Build errors
    • Firebase quota exceeded

πŸ“Š Workflow Summary Card

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ QUICK WORKFLOW REFERENCE β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 1. git checkout -b feature/name β”‚
β”‚ 2. Make changes β”‚
β”‚ 3. git add . && git commit -m "msg" β”‚
β”‚ 4. git push -u origin feature/name β”‚
β”‚ 5. Create PR β†’ develop β”‚
β”‚ 6. Test preview URL β”‚
β”‚ 7. Merge to develop (staging) β”‚
β”‚ 8. Test staging β”‚
β”‚ 9. PR develop β†’ main β”‚
β”‚ 10. Merge to main (production) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸŽ‰ You’re Ready!

This workflow ensures:

  • βœ… No accidental production deployments
  • βœ… Everything is tested before going live
  • βœ… Easy rollbacks if needed
  • βœ… Clear history of all changes
  • βœ… Collaborative development

Start with your first feature branch and experience the smooth deployment process!