GitHub Actions — Complete Guide
GitHub Actions — Complete Guide: free step-by-step lesson with examples, common mistakes, and interview tips — part of MEAN Stack Tutorial on Toolliyo Academy.
On this page
MEAN Stack Tutorial · Lesson 85 of 100
GitHub Actions
Stack ✓ → Projects
Projects · 2 — Apps · ~10 min · MEAN — DevOps & Deployment
What is this?
GitHub Actions CI runs MeanVerse tests, builds Docker images, and deploys on every push via workflow YAML.
Why should you care?
Manual deploys skip tests; automation enforces quality gate.
See it live — copy this example
Paste into your MeanVerse project (Angular + Express + MongoDB), then run with ng serve / node / mongosh as noted.
# .github/workflows/api-ci.yml
name: API CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
services:
mongo: { image: mongo:7, ports: ['27017:27017'] }
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: '20' }
- run: npm ci
working-directory: api
- run: npm test
working-directory: api
env: { MONGO_URI: mongodb://localhost:27017/meanverse_test }
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: docker/build-push-action@v6
with: { push: true, tags: ghcr.io/meanverse/api:${{ github.sha }} }
What happened?
- push triggers workflow.
- mongo service container for integration tests.
- build job pushes image tagged with git sha for traceability.
Practice next
- Add workflow on pull_request to main.
- Cache npm with actions/cache.
- Fail PR if lint or test fails.
- Add deploy job to AKS with kubectl.
- Run npm audit in workflow fail on critical.
Remember
Actions = CI/CD in repo. Test before build and deploy. Image tag = git sha for rollback.
PR quality gate
Junior dev breaks transfer validation.
Outcome: CI fails; merge blocked until fix — prod safe.
Interview prep for this lesson
Practice these questions aloud after reading—each links to a full structured answer.
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!