Skip to content

kmitsolution/GitHubAction

Repository files navigation

Complete GitHub Actions Tutorial Outline (Beginner → Advanced)


1. Introduction

  1. What is GitHub Actions?

  2. Why use GitHub Actions for CI/CD?

  3. Key concepts

    • Workflows
    • Events
    • Jobs
    • Steps
    • Runners
  4. YAML basics for GitHub Actions

  5. GitHub-hosted vs self-hosted runners


2. GitHub Actions Fundamentals (Beginner Level)

  1. Creating the first workflow
  2. Triggering workflows (push, pull_request, schedule, workflow_dispatch)
  3. Using actions from the marketplace
  4. Environment variables & secrets
  5. Artifacts (upload/download)
  6. Caching basics (npm, pip, gradle, maven)
  7. Using matrices to test multiple versions (Node/Java/Python)

3. Building CI Pipelines

  1. Setting up code checkout and environment

  2. Installing dependencies

  3. Running unit tests

  4. Linting and formatting

  5. Generating test reports

  6. Matrix CI pipelines

    • Multiple Node/Python/Java versions
    • OS matrix (windows, ubuntu, macOS)
  7. Using job dependencies (needs:)


4. Docker Integration (Intermediate)

  1. Writing Dockerfiles

  2. Building images using GitHub Actions

  3. Caching Docker layers

  4. Using Buildx & QEMU for multi-architecture builds

  5. Tagging strategies (latest, commit SHA, semantic versioning)

  6. Pushing images to registries:

    • GitHub Container Registry (GHCR)
    • Docker Hub
    • Azure Container Registry (ACR)
  7. Storing credentials securely using GitHub Secrets

  8. OIDC authentication (passwordless login to Azure)


5. CD Pipelines (Advanced)

  1. Introduction to deployment workflows
  2. Environments & deployment rules
  3. Manual approvals
  4. Reusable workflows for deployments
  5. Branch-based deployments (dev/staging/prod)
  6. Versioned deployments (tags & releases)

6. Kubernetes Integration (Advanced+)

  1. Kubernetes basics for CI/CD

  2. Deploying to AKS (Azure Kubernetes Service)

  3. Using kubectl in GitHub Actions

  4. Applying Kubernetes manifests

  5. Rolling updates

  6. Canary/Blue-Green deployment strategies

  7. Using Helm for deployment:

    • Writing a Helm chart
    • Passing values dynamically
    • Versioning Helm releases
  8. Secrets and configmaps management


7. Azure Integration (Enterprise Level)

  1. Azure setup required:

    • ACR
    • AKS
    • Azure Service Principal or OIDC federation
  2. Deploying Docker images to ACR

  3. Connecting ACR → AKS

  4. GitHub Actions authentication using OIDC

  5. Full CI/CD flow:

    • Build image
    • Push to ACR
    • Deploy to AKS
  6. Monitoring & logging deployment


8. Optimizing Pipelines

  1. Workflow-level caching (dependencies, Docker layers)

  2. Reusable workflows for DRY pipelines

  3. Conditional jobs (if:)

  4. Parallel jobs & matrix strategies

  5. Speed optimization:

    • Self-hosted runners
    • Build artifact reuse
    • Instance size selection
  6. Cost optimization & runner efficiency


9. Security & Compliance

  1. Secrets management
  2. OIDC vs classic secrets authentication
  3. Permissions (read/write)
  4. Least-privilege principle
  5. Dependency scanning & SAST with GitHub Advanced Security
  6. Container security scanning (Trivy, Snyk)

10. Real-World End-to-End Project

A complete production-grade pipeline including:

CI Pipeline

  • Lint
  • Unit tests
  • Integration tests
  • Matrix versions
  • Artifact upload

Docker Build Pipeline

  • Build image
  • Cache layers
  • Tag with SHA + version
  • Push to registry (GHCR/ACR)

CD Pipeline

  • Deploy to AKS using Helm
  • Detect changes
  • Roll out update
  • Check status
  • Notify Slack or Teams

Pipeline includes:

  • Branch strategies (PR → dev → staging → prod)
  • Manual approval gates
  • Rollback workflow
  • Automated version bump + release creation

11. Troubleshooting & Debugging

  1. Reading logs
  2. Enabling runner debug mode
  3. Handling failed jobs
  4. Retrying jobs
  5. Validating YAML
  6. Testing workflows locally with act

12. Final Best Practices

  • Use secrets sparingly
  • Prefer OIDC for cloud auth
  • Use reusable workflows
  • Keep CI fast (<10 mins)
  • Use environments + approvals
  • Automate everything: test → build → deploy → monitor

About

Tutorial for Github Action From Beginner to Advance Level

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published