最小 GitHub Actions 与 GitLab CI
High Contrast
Dark Mode
Light Mode
Sepia
Forest
1 min read190 words

最小 GitHub Actions 与 GitLab CI

你不需要一开始就写复杂流水线。一个能跑测试、构建、部署的最小配置就足够。

GitHub Actions 示例

name: deploy
on:
push:
branches: [main]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "run tests here"
- run: echo "build artifact here"
- run: echo "deploy here"

GitHub Actions vs GitLab CI

平台 特点
GitHub Actions 生态广、适合 GitHub 仓库
GitLab CI 集成度高、适合 GitLab 内部流

设计原则

本节执行清单

下一节构建、测试、部署、回滚串联——把单个 job 变成完整发布链。