0 Preface/Foreword
0.1 GitHub actions
GitLab中的CI/CD是++持续集成和持续交付/部署功能++ ,GitHub中与之相对应是++GitHub Actions++.
1 GitHub Actions
1.1 Github Actions vs GitLab CI/CD
++对照表如下++:
|----------------|----------------|--------------------------|
| 功能 | GitHub Actions | GitLab CI/CD |
| 配置文件 | .gitlab-ci.yml | .github/workflows/*.yml |
| CI(构建、测试) | ✅️ | ✅️ |
| CD(部署) | ✅️ | ✅️ |
| Pipeline (流水线) | ✅️ | ✅️ |
| Runner | GitLab Runner | GitHub Runner |
| 自托管 Runner | ✅️ | ✅️ |
| Docker构建 | ✅️ | ✅️ |
| 定时任务 | ✅️ | ✅️ |
| 手动触发 | ✅️ | ✅️ |
| 矩阵构建 | ✅️ | ✅️ |
| 环境变量/Secrets | ✅️ | ✅️ |
1.2 常见CI/CD场景
- 自动测试
- Docker镜像构建并推送
- 部署到Kubernetes
- 部署到AWS/Azure/GCP
- GitHub官方和云厂商都提供了大量现成的Action
- uses: azure/login@v2
- uses: aws-actions/configure-aws-credentials@v4
- GitHub官方和云厂商都提供了大量现成的Action
1.3 GitHub Actions的优势
1.3.1 Marektplace非常丰富
GitHub有大量现成插件(Action)
1.3.2 集成度更深
++支持++:
- pull request自动检查
- Code Review Gate
- Branch Protection
- Release自动发布
- Dependabot
- Security Scan (CodeQL)
1.3 GitHub Actions生成artifacts下载方法
++artifacts下载方法++:Actions > 查找workflows > 选择一个workflow > 找到artifacts > 点击下载icon。

