跳到正文

介绍 ​

GitHub Actions 在仓库里跑自动化工作流,常见用途是 CI/CD:测试、构建、发布、部署。

工作流是 .github/workflows/ 下的 YAML。事件触发后,GitHub 在 runner 上按 jobs → steps 执行。

最小示例 ​

  1. 创建 .github/workflows/ci.yml
  2. 写入:
yaml
name: 简单示例
on: push
jobs:
  hello:
    runs-on: ubuntu-latest
    steps:
      - name: 打印 Hello
        run: echo Hello, GitHub Actions!
  1. 提交并推送后,在仓库 Actions 页查看运行结果

下一步可读工作流语法与常用 Action。

基于 MIT 许可发布