Complete guide to workflow automation with GitHub Actions - from zero to production-ready pipelines.
Read the full tutorial at: CrashBytes - GitHub Actions CI/CD Complete Guide
# Clone the repository
git clone https://github.com/CrashBytes/crashbytes-tutorial-github-actions-ci-cd.git
cd crashbytes-tutorial-github-actions-ci-cd
# Install dependencies
npm install
# Run tests
npm test
# Run linting
npm run lint
# Start the application
npm start.
├── .github/
│ └── workflows/
│ ├── ci.yml # Basic CI workflow
│ ├── cd-staging.yml # Staging deployment
│ ├── cd-production.yml # Production deployment
│ ├── docker-build.yml # Docker image builds
│ ├── matrix-testing.yml # Matrix test strategy
│ └── reusable-workflow.yml # Reusable workflow template
├── src/
│ ├── index.js # Application entry point
│ ├── utils.js # Utility functions
│ └── api.js # API handlers
├── tests/
│ └── index.test.js # Unit tests
├── Dockerfile # Container definition
├── package.json # Dependencies and scripts
└── README.md # This file
- Code linting with ESLint
- Unit testing with Jest
- Coverage report generation
- Build verification
- Tests across Node.js 18, 20, 22
- Tests on Ubuntu, Windows, macOS
- Parallel execution for speed
- Multi-stage Docker builds
- GitHub Container Registry (ghcr.io) publishing
- Automatic semantic versioning tags
- Triggered on
developbranch pushes - Environment-specific configuration
- Post-deployment notifications
- Triggered on GitHub releases
- Pre-deployment validation
- Manual approval gates (configure in repo settings)
- Deployment summaries
- Parameterized Node.js version
- Optional coverage generation
- Configurable working directory
- Output test results
| Command | Description |
|---|---|
npm start |
Run the application |
npm test |
Run unit tests |
npm run test:coverage |
Run tests with coverage |
npm run lint |
Check code style |
npm run lint:fix |
Auto-fix style issues |
npm run build |
Lint and test |
For full functionality, configure these secrets in your repository:
| Secret | Description | Required For |
|---|---|---|
GITHUB_TOKEN |
Auto-provided by GitHub | Docker builds |
STAGING_DEPLOY_TOKEN |
Staging environment credentials | Staging deploys |
PRODUCTION_DEPLOY_TOKEN |
Production environment credentials | Production deploys |
- GitHub Actions Fundamentals - Workflows, jobs, steps, events
- CI Pipeline Design - Testing, linting, building
- Matrix Strategies - Multi-version, multi-OS testing
- Caching - Dependency and build caching
- Docker Integration - Build and push container images
- Deployment Automation - Staging and production pipelines
- Secrets Management - Secure credential handling
- Reusable Workflows - DRY pipeline configuration
This is a tutorial repository. Feel free to:
- Open issues for questions
- Submit PRs for improvements
- Fork for your own learning
MIT License - See LICENSE for details.
Author: CrashBytes
Published: November 24, 2025