GitHub Actions Tutorial (Practical Guide)

included docker build and push on Docker hub automatically

1. What is GitHub Actions?

GitHub Actions is GitHub's built-in CI/CD automation service. You can:
  • Run workflows on events like push, PR, tag, cron, etc.
  • Define custom build/test/deploy jobs
  • Commonly used for testing, building, and Docker publishing

2. Directory Structure


3. Basic Workflow Example

4. Managing Secrets

  1. Go to GitHub → Repo Settings → Secrets → Actions
  1. Add:
      • DOCKER_USERNAME
      • DOCKER_PASSWORD (or access token)
  1. Use via ${{ secrets.NAME }}

5. Docker Build + Push Example


6. Manual Trigger

Use workflow_dispatch to enable manual run button from the GitHub Actions page.

7. Logs and Debug

  • Go to GitHub → Actions → Select a job → View logs step-by-step.

8. Real Use Cases

Scenario
Applicable?
Build and push Docker image
✅ Yes
Trigger only when container/ changes
✅ Yes
Tag-based release builds
✅ Yes
Scheduled data refresh
✅ Yes
Auto deploy to Kubernetes
✅ Yes

Advanced

  • Auto-upload build artifacts to Releases
  • Email/Slack notifications on failure
  • GitOps with ArgoCD or Flux
  • Deploy to HuggingFace, GHCR, etc.
Generate a Minimal Dependency List with pipreqsMemory and Computation in LLM Inference: Transformers vs. RWKV
Loading...