ci-cd-builder

enoch-robinson's avatarfrom enoch-robinson

CI/CD 流水线配置指南。当用户需要配置 GitHub Actions、GitLab CI、自动化测试、自动部署或持续集成/持续部署流程时使用此技能。

0stars🔀0forks📁View on GitHub🕐Updated Jan 10, 2026

When & Why to Use This Skill

The CI/CD Builder is a comprehensive automation guide designed to help developers streamline their software delivery lifecycle. It provides production-ready templates and best practices for GitHub Actions, GitLab CI, and Jenkins, enabling teams to automate testing, building, and deployment processes with high efficiency and security.

Use Cases

  • Automated Testing and Linting: Setting up Node.js workflows to automatically run test suites and code quality checks on every pull request to prevent regressions.
  • Containerized Workflows: Configuring automated Docker build and push sequences to container registries like GHCR or Docker Hub for seamless cloud-native deployments.
  • Build Performance Optimization: Implementing advanced caching strategies for dependencies and parallel job execution to significantly reduce CI/CD pipeline duration.
  • Secure Deployment Management: Utilizing environment secrets and conditional execution logic to safely deploy applications to production only when specific criteria are met.
nameci-cd-builder
descriptionCI/CD 流水线配置指南。当用户需要配置 GitHub Actions、GitLab CI、自动化测试、自动部署或持续集成/持续部署流程时使用此技能。

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 }}

最佳实践

  1. 快速反馈:测试任务并行执行
  2. 缓存优化:缓存依赖减少构建时间
  3. 安全存储:敏感信息使用 Secrets
  4. 版本锁定:固定 Action 版本号
  5. 失败通知:配置 Slack/邮件通知

参考资源

ci-cd-builder – AI Agent Skills | Claude Skills