CI/CD Documentation
Overview
Lager Guru uses GitHub Actions for continuous integration and deployment.
CI Pipeline
Triggers
- Push to
mainordevelopbranches - Pull requests to
mainordevelop
Steps
- Checkout code - Retrieves latest code
- Setup Node.js - Installs Node.js 18
- Install dependencies - Runs
npm ci - TypeScript check - Validates types
- ESLint - Code linting
- Security audit - Dependency scanning
- Build - Creates production bundle
- Upload artifacts - Stores build files
Workflow File
.github/workflows/ci.yml
CD Pipeline
Triggers
- Push of version tag (e.g.,
v1.0.0)
Steps
- Build Docker image - Multi-stage build
- Push to GHCR - GitHub Container Registry
- Deploy to server - SSH deployment
- Health check - Verifies deployment
Workflow File
.github/workflows/cd.yml
Required Secrets
CI Secrets
VITE_SUPABASE_URL(optional)VITE_SUPABASE_PUBLISHABLE_KEY(optional)
CD Secrets
VITE_SUPABASE_URLVITE_SUPABASE_PUBLISHABLE_KEYVITE_WEB_PUSH_PUBLIC_KEY(optional)SSH_HOSTSSH_USERSSH_KEY
Deployment Process
Creating a Release
- Update version in code
- Create git tag:
bash
git tag -a v1.0.0 -m "Release version 1.0.0"
git push origin v1.0.0- GitHub Actions automatically:
- Builds Docker image
- Pushes to GHCR
- Deploys to production
- Runs health checks
Monitoring Deployment
- Check GitHub Actions tab
- View workflow logs
- Verify health endpoint
- Check application logs
Docker Images
Image Tags
ghcr.io/<owner>/lager-guru:<git-sha>- Commit SHAghcr.io/<owner>/lager-guru:latest- Latestghcr.io/<owner>/lager-guru:<version>- Version tag
Pulling Images
bash
docker pull ghcr.io/<owner>/lager-guru:latestTroubleshooting
CI Failures
- Check TypeScript errors
- Review ESLint warnings
- Verify build process
- Check dependency issues
CD Failures
- Verify SSH credentials
- Check server connectivity
- Review deployment logs
- Verify Docker setup on server
Best Practices
Versioning
- Use semantic versioning (semver)
- Tag releases consistently
- Document breaking changes
Testing
- Run tests before tagging
- Test in staging environment
- Verify health checks
Rollback
If deployment fails:
- Revert to previous tag
- Manually pull previous image
- Restart services
Local Testing
Test CI Locally
bash
# Install act (GitHub Actions locally)
brew install act
# Run CI workflow
act pushTest Docker Build
bash
docker build -t lager-guru:test .
docker run -p 80:80 lager-guru:testAdvanced Configuration
Custom Deployment
Modify .github/workflows/cd.yml for:
- Multiple environments
- Custom deployment steps
- Additional health checks
Notifications
Add notification steps to workflows:
- Slack notifications
- Email alerts
- Discord webhooks