Overview
SkillRise uses GitHub Actions for continuous integration and deployment. The pipeline consists of two workflows:Build Workflow
Runs on pull requests to validate code quality
Deploy Workflow
Builds and pushes Docker images on main branch
Build Workflow
The build workflow runs on every pull request to ensure code quality before merging.Configuration
.github/workflows/build.yml
Workflow Stages
Client Validation
The client job validates the React frontend:
Uses
Checks for code quality issues, potential bugs, and style violations.Configuration:
Verifies consistent code formatting without modifying files.Configuration:
Compiles the React app with Vite to ensure no build errors.Build-time environment variables:
Dependency Installation
Dependency Installation
npm ci for clean, reproducible installs based on package-lock.json.ESLint
ESLint
eslint.config.js- React hooks rules
- React refresh plugin
- Prettier integration
Prettier
Prettier
.prettierrc- 2-space indentation
- Single quotes
- Semicolons
- Trailing commas
Build
Build
VITE_CLERK_PUBLISHABLE_KEYVITE_STRIPE_PUBLISHABLE_KEYVITE_BACKEND_URL
Server Validation
The server job validates the Node.js backend:
Installs all dependencies including devDependencies for linting.
Checks Express server code for issues.Configuration:
Ensures consistent formatting across all server files.
Dependency Installation
Dependency Installation
ESLint
ESLint
eslint.config.js- Node.js globals
- ES2022 syntax
- Prettier integration
Prettier
Prettier
Running Locally
You can run the same checks locally before pushing:Deploy Workflow
The deploy workflow automatically builds and pushes Docker images when code is merged to the main branch.Configuration
.github/workflows/deploy.yml
Workflow Stages
Server Image Build
The
Clones the repository with full git history.
Authenticates with Docker Hub using repository secrets.
Process:
Build time: ~2-3 minutes
build-and-push-server job creates the backend Docker image:Checkout Code
Checkout Code
Docker Hub Login
Docker Hub Login
Build and Push
Build and Push
- Builds image from
server/Dockerfile - Tags as
pushkarverma/skillrise-server:latest - Pushes to Docker Hub
- Replaces previous
latesttag
Build time: ~2-3 minutes
Client Image Build
The
Build arguments:
Build time: ~3-4 minutes
build-and-push-client job creates the frontend Docker image:Checkout and Login
Checkout and Login
Same as server: checks out code and authenticates with Docker Hub.
Build and Push with Arguments
Build and Push with Arguments
VITE_CLERK_PUBLISHABLE_KEY- Embedded in build for authenticationVITE_STRIPE_PUBLISHABLE_KEY- Embedded in build for paymentsVITE_BACKEND_URL- API endpoint URL
- Stage 1: Compiles React app with Vite
- Stage 2: Copies build to Nginx image
Build time: ~3-4 minutes
Job Execution
Both jobs run in parallel for faster deployment. They are independent and don’t wait for each other.
Required Secrets
Configure these secrets in your GitHub repository settings:Docker Hub Credentials
Docker Hub Credentials
DOCKER_USERNAMEYour Docker Hub username
DOCKER_PASSWORDDocker Hub access token (recommended) or password
Client Build Variables
Client Build Variables
VITE_CLERK_PUBLISHABLE_KEYClerk publishable key for authentication
Example:
pk_test_... or pk_live_...VITE_STRIPE_PUBLISHABLE_KEYStripe publishable key for payments
Example:
pk_test_... or pk_live_...VITE_BACKEND_URLBackend API URL
Example:
https://api.yourdomain.com or http://localhost:3000Adding Secrets
Navigate to Repository Settings
Go to your GitHub repository → Settings → Secrets and variables → Actions
Enter Secret Details
- Name: Use exact names from the list above (case-sensitive)
- Value: Paste the secret value
- Click Add secret
Triggering Deployments
Automatic Deployment
Deployment triggers automatically when:main:
Manual Deployment
To trigger manually without code changes:Monitoring Workflow Runs
View Run Status
- Go to the Actions tab in your repository
- Click on a workflow run to see details
- Expand jobs to view step-by-step logs
Status Indicators
Success
All jobs completed successfully
In Progress
Workflow is currently running
Failed
One or more jobs failed
Common Failure Reasons
Build Workflow Failures
Build Workflow Failures
ESLint errors:Fix: Run Fix: Run Fix: Run
npm run lint:fix locally and commit fixesPrettier errors:npm run format locally and commit changesBuild errors:npm run build locally to identify the issueDeploy Workflow Failures
Deploy Workflow Failures
Docker login failed:Fix: Verify Fix: Ensure Dockerfile exists in the correct directoryPush failed:Fix: Check Docker Hub repository permissions and credentialsBuild args missing:Fix: Verify all client build secrets are configured
DOCKER_USERNAME and DOCKER_PASSWORD secretsBuild context error:Workflow Optimization
Caching Dependencies
Add caching to speed up builds:Docker Layer Caching
Enable BuildKit cache:Matrix Builds
Test multiple Node versions:Advanced Workflows
Environment-Specific Deployments
Deploy to staging and production:Slack Notifications
Send deployment status to Slack:Automated Rollbacks
Revert to previous image on failure:Best Practices
Version Tagging
Use semantic versioning alongside
latest:Branch Protection
Require CI checks to pass before merging:
- Go to Settings → Branches
- Add rule for
main - Enable “Require status checks”
- Select CI jobs
Secrets Rotation
Regularly rotate credentials:
- Docker Hub tokens every 90 days
- API keys when team members leave
- Use different keys for staging/production
Monitoring
Track deployment metrics:
- Build duration trends
- Image size changes
- Deployment frequency
- Failure rates