CI/CD流水线

diegosouzapw2026-10-28查看 1481复制 1087

在设置 GitHub Actions、自动化测试、构建检查或部署工作流时使用。触发词为 "CI/CD"、"pipeline"、"GitHub Actions"、"deploy"、"automated testing"、"build check"。

Download (.md)

📘如何使用这个技能

  1. 1
    复制技能内容·点击上方「Copy SKILL.md」复制全部内容,或 Download 下载到本地
  2. 2
    打开你的 AI 客户端·支持 Claude Code、Trae、Cursor、ChatGPT、DeepSeek、Kimi 等任意 AI 助手
  3. 3
    粘贴为系统提示/知识文件·Claude Code:放入 .claude/skills/ 目录;普通对话:作为首条消息发送并说「请严格按这份技能文档执行」
  4. 4
    直接提出你的需求·AI 会按技能定义的工作流、格式和约束来处理,无需再解释背景

💡 提示:技能生效后,每次对话只需一句需求,AI 会按 SKILL.md 的流程执行。

SKILL.md1845 chars
---
name: cicd-pipeline
description: Use when setting up GitHub Actions, automated testing, build checks, or deployment workflows. Triggers on "CI/CD", "pipeline", "GitHub Actions", "deploy", "automated testing", "build check".
---

# CI/CD Pipeline

## Overview

Set up continuous integration and deployment with GitHub Actions, build verification, and deployment gates.

## When to Use

- Setting up CI/CD from scratch
- Adding build checks to PRs
- Configuring automated test runs
- Production deployment automation

## Workflow

### Phase 1: CI Workflow

`.github/workflows/ci.yml`:
```yaml
name: CI
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: npm
      - run: npm ci
      - run: npm run lint
      - run: npm run build
      - run: npm run test

  edge-functions:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: denoland/setup-deno@v2
      - run: deno check supabase/functions/*/index.ts
```

### Phase 2: Deploy Workflow

```yaml
  deploy:
    needs: [build, edge-functions]
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20, cache: npm }
      - run: npm ci && npm run build
      # Deploy to hosting + edge functions
```

### Phase 3: Branch Protection

1. Require CI pass before merge
2. Require PR review
3. No force push to main

## Checklist

- [ ] CI runs on push + PRs
- [ ] Build, lint, test steps
- [ ] Edge function type check
- [ ] Deploy only on main after checks pass
- [ ] Secrets in GitHub Actions secrets
- [ ] Branch protection rules enabled
来源:skillsdirectory

评论0

登录后参与评论

还没有评论,来抢沙发吧