Implementing CI/CD Pipelines with GitHub Actions for Full-Stack Applications
As Head of Information Technology for INTRIVIA 2025, one of my main responsibilities was designing and implementing CI/CD pipelines for both backend and frontend deployments. In this article, I'll share the approach I took and lessons learned along the way.
The Challenge
We had a Next.js frontend and Go backend that needed to be deployed to a faculty-provided VPS. The goals were:
- Automate deployment on every push to main
- Minimize downtime during deployments
- Maintain separate staging and production environments
- Enable easy rollbacks if something goes wrong
The Solution: GitHub Actions
GitHub Actions proved to be the perfect choice because:
- Free for public repositories
- Native GitHub integration
- Flexible workflow configuration
- Good community support
Backend CI/CD Pipeline
Here's the workflow I created for the Go backend:
name: Backend CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Run tests
run: go test -v ./...
Key Implementation Details
1. Environment Variables
Store sensitive data in GitHub Secrets:
- Database credentials
- API keys
- SSH keys for deployment
- Docker registry credentials
2. Zero-Downtime Deployment
Use Docker's rolling updates:
docker-compose up -d --no-deps --build backend
3. Health Checks
Implement health check endpoints:
func HealthCheck(c *fiber.Ctx) error {
return c.JSON(fiber.Map{
"status": "healthy",
"timestamp": time.Now(),
})
}
Results
After implementing these pipelines:
- Deployment time reduced from 15 minutes to 3 minutes
- Zero deployment-related incidents during INTRIVIA 2025
- Easy rollbacks when needed
- Improved team confidence in pushing changes
Best Practices
- Test before deploy: Always run tests in CI
- Use staging environments: Test deployments before production
- Keep secrets secure: Never commit credentials
- Monitor deployments: Set up alerts for failures
- Document everything: README with deployment procedures
Conclusion
Implementing CI/CD pipelines significantly improved our development workflow and deployment reliability. While the initial setup took time, the productivity gains and peace of mind made it worthwhile.
Tools used:
- GitHub Actions
- Docker & Docker Compose
- SSH for VPS deployment
- Telegram for notifications