Claude-skill-registry ci-cd-builder
CI/CD 流水线配置指南。当用户需要配置 GitHub Actions、GitLab CI、自动化测试、自动部署或持续集成/持续部署流程时使用此技能。
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/ci-cd-builder" ~/.claude/skills/majiayu000-claude-skill-registry-ci-cd-builder && rm -rf "$T"
manifest:
skills/data/ci-cd-builder/SKILL.mdsource content
CI/CD Builder
帮助开发者快速搭建高效的持续集成和持续部署流水线。
支持平台
- GitHub Actions(主要)
- GitLab CI/CD
- Jenkins
- CircleCI
GitHub Actions 模板
Node.js 项目
name: CI/CD Pipeline on: push: branches: [main, develop] pull_request: branches: [main] jobs: test: 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 test - run: npm run lint build: needs: test 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 build - uses: actions/upload-artifact@v4 with: name: build path: dist/
Docker 构建与推送
docker: needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - uses: docker/build-push-action@v5 with: push: true tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
##常用配置片段
缓存依赖
- uses: actions/cache@v4 with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
条件执行
- name: Deploy to Production if: github.ref == 'refs/heads/main' run: ./deploy.sh
Secrets 使用
env: API_KEY: ${{ secrets.API_KEY }} DATABASE_URL: ${{ secrets.DATABASE_URL }}
最佳实践
- 快速反馈:测试任务并行执行
- 缓存优化:缓存依赖减少构建时间
- 安全存储:敏感信息使用 Secrets
- 版本锁定:固定 Action 版本号
- 失败通知:配置 Slack/邮件通知
参考资源
- GitHub Actions 文档: https://docs.github.com/en/actions
- GitLab CI 文档: https://docs.gitlab.com/ee/ci/