# CI/CD 流水线搭建

自动化部署的最佳实践。

## GitHub Actions

```yaml
name: Deploy
on: [push]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: npm install
      - run: npm test
      - run: npm run build
```

## GitLab CI

```yaml
deploy:
  stage: deploy
  script:
    - echo "Deploying..."
  only:
    - main
```

## 最佳实践

- 自动化测试
- 环境隔离
- 回滚机制

你的 CI/CD 流程是怎样的？