type
status
date
slug
summary
tags
category
icon
password
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
- Go to GitHub → Repo Settings → Secrets → Actions
- Add:
DOCKER_USERNAME
DOCKER_PASSWORD
(or access token)
- 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.
- 作者:Sylvia
- 链接:https://vibesylvia.top/article/22cbeda9-55cb-8046-9f26-fa4f3fa097dc
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。