Ci Cd

codewithmukesh/dotnet-claude-kit/skills/ci-cd

by codewithmukesh23300897f4d1No license754 starsListed Oct 8, 2026Updated Oct 8, 2026Repository updated 2 months ago

CI/CD pipelines for .NET applications. Covers GitHub Actions and Azure DevOps YAML pipelines with build, test, publish, and deploy stages. Load this skill when setting up continuous integration, automated testing, deployment workflows, or when the user mentions "CI/CD", "pipeline", "GitHub Actions", "Azure DevOps", "workflow", "deploy", "build pipeline", "publish", "NuGet push", "release", or "continuous integration".

Instructions onlyDevOps & Cloud
AI-generated overview

Guides setting up CI/CD pipelines for .NET apps with GitHub Actions and Azure DevOps YAML.

What it does
This skill provides guidance and YAML examples for building continuous integration and delivery pipelines for .NET applications. It covers GitHub Actions and Azure DevOps workflows with restore, build, format check, test, publish, and deploy stages, plus Docker image and NuGet package publishing. It also lists anti-patterns and a decision guide for choosing a platform.
When to use it
Use it when setting up continuous integration, automated testing, or deployment workflows for .NET projects. It also fits requests mentioning CI/CD, pipelines, GitHub Actions, Azure DevOps, build pipelines, releases, or NuGet push.
Requirements
No scripts are included; it is instructions and YAML examples only. Running the described pipelines requires a repository with GitHub Actions or Azure DevOps, the .NET SDK, and credentials such as a NuGet API key or container registry token.

CI/CD

Core Principles

  1. Pipeline as code — YAML pipelines committed to the repo. No click-ops in the UI.
  2. Fast feedback — Build and test on every push. Cache NuGet packages. Fail fast.
  3. Build once, deploy many — Build the artifact once, promote it through environments (dev → staging → production).
  4. Never skip tests — Tests gate the pipeline. No deployment without passing tests.

Patterns

GitHub Actions — Build + Test

yaml
# .github/workflows/ci.ymlname: CI
on:  push:    branches: [main]  pull_request:    branches: [main]
env:  DOTNET_VERSION: '10.0.x'  DOTNET_NOLOGO: true  DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:  build-and-test:    runs-on: ubuntu-latest
    services:      postgres:        image: postgres:18        env:          POSTGRES_DB: testdb          POSTGRES_USER: postgres          POSTGRES_PASSWORD: postgres        ports:          - 5432:5432        options: >-          --health-cmd pg_isready          --health-interval 10s          --health-timeout 5s          --health-retries 5
    steps:      - uses: actions/checkout@v5
      - name: Setup .NET        uses: actions/setup-dotnet@v5        with:          dotnet-version: ${{ env.DOTNET_VERSION }}
      - name: Restore        run: dotnet restore
      - name: Build        run: dotnet build --no-restore --configuration Release
      - name: Format check        run: dotnet format --verify-no-changes --no-restore
      - name: Test        run: dotnet test --no-build --configuration Release --logger trx --results-directory TestResults        env:          ConnectionStrings__Default: "Host=localhost;Database=testdb;Username=postgres;Password=postgres"
      - name: Publish test results        uses: actions/upload-artifact@v5        if: always()        with:          name: test-results          path: TestResults/*.trx

GitHub Actions — Build + Publish Docker Image

yaml
# .github/workflows/publish.ymlname: Publish
on:  push:    tags: ['v*']
jobs:  publish:    runs-on: ubuntu-latest    permissions:      contents: read      packages: write
    steps:      - uses: actions/checkout@v5
      - name: Login to GitHub Container Registry        uses: docker/login-action@v3        with:          registry: ghcr.io          username: ${{ github.actor }}          password: ${{ secrets.GITHUB_TOKEN }}
      - name: Extract version from tag        id: version        run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
      - name: Build and push        uses: docker/build-push-action@v6        with:          context: .          push: true          tags: |            ghcr.io/${{ github.repository }}:${{ steps.version.outputs.VERSION }}            ghcr.io/${{ github.repository }}:latest

Azure DevOps — Build + Test

Same restore → build → format → test flow as GitHub Actions. Key differences:

yaml
# azure-pipelines.ymltrigger:  branches:    include: [main]  paths:    exclude: ['*.md', docs/]
pool:  vmImage: 'ubuntu-latest'          # vs runs-on: ubuntu-latest
variables:  dotnetVersion: '10.0.x'
# Key task differences from GitHub Actions:#   Setup .NET:  task: UseDotNet@2  (inputs: version: $(dotnetVersion))#   Test results: task: PublishTestResults@2  (testResultsFormat: VSTest)#   Steps use `script:` + `displayName:` instead of `- name:` + `run:`#   Services (e.g., Postgres) require a separate Docker task or pipeline service connection

NuGet Package Publishing

yaml
# Part of GitHub Actions workflow- name: Pack  run: dotnet pack src/MyLibrary -c Release -o ./nupkg --no-build
- name: Push to NuGet  run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

Anti-patterns

Don't Build Different Artifacts per Environment

yaml
# BAD — building separately for each environment- script: dotnet publish -c Debug   # for dev- script: dotnet publish -c Release # for prod
# GOOD — build once, deploy everywhere- script: dotnet publish -c Release -o ./publish# Then deploy the same ./publish artifact to dev, staging, prod

Don't Skip Format Checks in CI

yaml
# BAD — no format enforcementsteps:  - run: dotnet build  - run: dotnet test
# GOOD — format check catches style issues earlysteps:  - run: dotnet build  - run: dotnet format --verify-no-changes  - run: dotnet test

Don't Hardcode Secrets in Pipelines

yaml
# BAD — secret in pipeline YAMLenv:  DB_PASSWORD: "my-secret-password"
# GOOD — use pipeline secretsenv:  DB_PASSWORD: ${{ secrets.DB_PASSWORD }}

Decision Guide

ScenarioRecommendation
Open source projectGitHub Actions
Enterprise with AzureAzure DevOps Pipelines
Docker deploymentMulti-stage build in CI, push to container registry
NuGet libraryBuild → Test → Pack → Push on tag
Database migrationsRun in CI test stage, script for production
Environment promotionSame artifact, different configuration

Source and attribution

Source:codewithmukesh/dotnet-claude-kitinskills/ci-cdat commit2330089

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal

More from codewithmukesh/dotnet-claude-kit

Wrap Up

codewithmukesh

Captures end-of-session work, pending tasks and learnings into a handoff file, and reloads it at session start.

Productivity & Workflow754updated 2 months ago

Workflow Mastery

codewithmukesh

Claude Code workflow mastery for .NET developers. Covers parallel execution with git worktrees, plan mode strategy, verification loops, auto-formatting hooks, permission setup for dotnet CLI, prompting techniques, subagent patterns, and context discipline — token budget management, MCP-first navigation, lazy loading, and subagent isolation — all adapted for the .NET ecosystem. Load this skill when setting up Claude Code for a .NET project, optimizing workflows, running parallel sessions, when context is running low or sessions feel sluggish, when exploring a large codebase efficiently, or when the user mentions "productivity", "workflow", "parallel", "worktree", "plan mode", "permissions", "hooks", "10x", "setup Claude Code", "speed up development", "context", "tokens", "budget", "running out of context", "too many files", or "large codebase". Inspired by tips from Boris Cherny (creator of Claude Code) and the Anthropic team.

Awaiting classification754updated 2 months ago

Vertical Slice

codewithmukesh

Guides .NET developers in structuring applications with Vertical Slice Architecture, covering feature folders, endpoint grouping and handler patterns.

Software Development754updated 2 months ago

Testing

codewithmukesh

Testing strategy for .NET 10 applications. Covers xUnit v3, WebApplicationFactory for integration tests, Testcontainers for real database testing, Verify for snapshot testing, and the AAA pattern. Load this skill when writing tests, setting up test infrastructure, reviewing test coverage, or when the user mentions "test", "xUnit", "WebApplicationFactory", "Testcontainers", "integration test", "unit test", "bUnit", "snapshot test", "Verify", "test coverage", "AAA pattern", "WireMock", or "FakeTimeProvider".

Awaiting classification754updated 2 months ago

Tdd

codewithmukesh

Guided test-driven development workflow for .NET 10 using xUnit v3, WebApplicationFactory, Testcontainers, and Verify snapshots. Follows the strict red-green-refactor cycle. Use when: "TDD", "test-driven", "let's TDD this", "red green refactor", "write the test first", or when building a feature with clear acceptance criteria.

Awaiting classification754updated 2 months ago

Spec

codewithmukesh

Turns a vague feature idea into an agreed, persisted specification file through structured questioning rounds.

Productivity & Workflow754updated 2 months ago