Set Up a CI/CD Pipeline — Detailed Sequence of Steps
1. Scan the project root for configuration files that reveal the tech stack:
1. Scan the project root for configuration files that reveal the tech stack:
--- description: "Workflow that uses Cline to analyze a project's tech stack and generate a complete CI/CD pipeline configuration with appropriate stages for linting, testing, building, and deploying." author: "Cline Community" version: "1.0" category: "CI/CD" tags: ["ci-cd", "github-actions", "gitlab-ci", "devops", "pipeline", "automation", "setup"] globs: ["*.*"] ---
<task name="Set Up a CI/CD Pipeline for Your Project">
<task_objective> Analyze the user's project to detect its tech stack, test frameworks, and build tools, then generate a complete CI/CD pipeline configuration file with appropriate stages (lint, test, build, deploy). The output is a ready-to-use pipeline config committed to the project. </task_objective>
<detailed_sequence_steps>
ls -la package.json pyproject.toml Cargo.toml go.mod Gemfile pom.xml build.gradle Makefile Dockerfile docker-compose.yml 2>/dev/null ls -la .github/workflows/ .gitlab-ci.yml .circleci/ Jenkinsfile 2>/dev/null <ask_followup_question>
<question>Which CI/CD platform should I generate a pipeline for?</question>
<options>["GitHub Actions", "GitLab CI", "Other (I'll specify)"]</options>
</ask_followup_question>| Stage | Purpose | Example Commands | |-------|---------|-----------------| | **Install** | Install dependencies | `npm ci`, `uv sync`, `pip install` | | **Lint** | Static analysis & formatting | `eslint .`, `ruff check .`, `cargo clippy` | | **Test** | Run test suite | `npm test`, `pytest`, `go test ./...` | | **Build** | Compile / bundle | `npm run build`, `cargo build --release` | | **Deploy** | Ship to environment | `docker push`, `aws deploy`, `vercel deploy` |
<ask_followup_question>
<question>Based on your project, I recommend these pipeline stages:
1. **Install** — Install dependencies
2. **Lint** — Run linter/formatter checks
3. **Test** — Run the test suite
4. **Build** — Build/compile the project
Would you also like a deploy stage?</question>
<options>["Yes, add a deploy stage", "No, just CI (lint + test + build)", "Let me customize the stages"]</options>
</ask_followup_question> <ask_followup_question>
<question>Where do you deploy this project?</question>
<options>["Docker / Container Registry", "Vercel", "AWS (ECS, Lambda, S3, etc.)", "Google Cloud", "Custom server (SSH)", "Other (I'll specify)"]</options>
</ask_followup_question> <ask_followup_question>
<question>When should this pipeline run?</question>
<options>["On every pull request", "On push to main/master", "On both PRs and pushes to main", "Custom (I'll specify)"]</options>
</ask_followup_question>🚨 **CRITICAL: All sensitive credentials (API keys, deploy tokens, registry passwords) must ONLY be stored in the CI platform's encrypted secrets manager.** Never hardcode secrets in pipeline config files, commit them to version control, echo them in logs, or pass them as CLI arguments.
**GitHub Actions:**
Go to repo → Settings → Secrets and variables → Actions → New repository secret
Each secret is encrypted at rest and masked in job logs automatically.**GitLab CI:**
Go to project → Settings → CI/CD → Variables → Add variable
Enable "Mask variable" to prevent it from appearing in logs.
Use "Protect variable" to restrict to protected branches if appropriate. name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Run tests
run: npm test
- name: Build
run: npm run build name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
ci:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-extras
- name: Lint
run: uv run ruff check .
- name: Run tests
run: uv run pytest stages:
- install
- lint
- test
- build
default:
image: node:20
install:
stage: install
script:
- npm ci
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- node_modules/
lint:
stage: lint
script:
- npm run lint
test:
stage: test
script:
- npm test
build:
stage: build
script:
- npm run build
artifacts:
paths:
- dist/ <ask_followup_question>
<question>Would you like to also add a Cline CLI step to your pipeline for automated tasks like PR review or test generation? (This uses the Cline CLI as an AI agent in CI.)</question>
<options>["Yes, add a Cline CLI step", "No, just the standard pipeline"]</options>
</ask_followup_question> <ask_followup_question>
<question>I found an existing CI config file. How should I handle it?</question>
<options>["Replace it with the new config", "Create a new file alongside it", "Show me the new config without writing it"]</options>
</ask_followup_question></detailed_sequence_steps>
</task>