用 GitHub Actions 配置 CI/CD
开发者可生成结构清晰、可直接复制粘贴、带图片提示的教程用于文档,从中受益。
查看输入和输出预览
输入
- 任务 / 待完成内容
- Set up a CI/CD pipeline with GitHub Actions for a Node.js app
- 难度等级
- 中级 — 假设具备基础知识
- 包含配图位置说明?
- 是 — 添加带描述的 [IMAGE] 标记
- 所需工具 / 软件
- GitHub account, Node.js 18+, a repository with npm scripts
输出(节选)
How to Set Up a CI/CD Pipeline with GitHub Actions
Prerequisites: GitHub account, Node.js 18+, a repo with `npm test` and `npm run build`.
Step 1 — Create the workflow file. In your repo, add `.github/workflows/ci.yml`. [Image: screenshot of the file tree showing the new workflow folder]
Step 2 — Define the trigger. Set the workflow to run on every push and pull request to main:
```yaml
on:
push:
branches: [main]
```
Step 3 — Add the test job...