<< All versions
Skill v1.0.1
currentAutomated scan100/100codewithmukesh/dotnet-claude-kit/ci-cd
+3 new
──Details
PublishedAugust 14, 2026 at 02:25 PM
Content Hashsha256:30cc42d8268decb7...
Git SHA23300897f4d1
Bump Typepatch
──Files
Files (1 file, 5.5 KB)
SKILL.md5.5 KBactive
SKILL.md · 218 lines · 5.5 KB
version: "1.0.1" name: ci-cd description: > 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".
CI/CD
Core Principles
- Pipeline as code — YAML pipelines committed to the repo. No click-ops in the UI.
- Fast feedback — Build and test on every push. Cache NuGet packages. Fail fast.
- Build once, deploy many — Build the artifact once, promote it through environments (dev → staging → production).
- Never skip tests — Tests gate the pipeline. No deployment without passing tests.
Patterns
GitHub Actions — Build + Test
yaml
# .github/workflows/ci.ymlname: CIon:push:branches: [main]pull_request:branches: [main]env:DOTNET_VERSION: '10.0.x'DOTNET_NOLOGO: trueDOTNET_CLI_TELEMETRY_OPTOUT: truejobs:build-and-test:runs-on: ubuntu-latestservices:postgres:image: postgres:18env:POSTGRES_DB: testdbPOSTGRES_USER: postgresPOSTGRES_PASSWORD: postgresports:- 5432:5432options: >---health-cmd pg_isready--health-interval 10s--health-timeout 5s--health-retries 5steps:- uses: actions/checkout@v5- name: Setup .NETuses: actions/setup-dotnet@v5with:dotnet-version: ${{ env.DOTNET_VERSION }}- name: Restorerun: dotnet restore- name: Buildrun: dotnet build --no-restore --configuration Release- name: Format checkrun: dotnet format --verify-no-changes --no-restore- name: Testrun: dotnet test --no-build --configuration Release --logger trx --results-directory TestResultsenv:ConnectionStrings__Default: "Host=localhost;Database=testdb;Username=postgres;Password=postgres"- name: Publish test resultsuses: actions/upload-artifact@v5if: always()with:name: test-resultspath: TestResults/*.trx
GitHub Actions — Build + Publish Docker Image
yaml
# .github/workflows/publish.ymlname: Publishon:push:tags: ['v*']jobs:publish:runs-on: ubuntu-latestpermissions:contents: readpackages: writesteps:- uses: actions/checkout@v5- name: Login to GitHub Container Registryuses: docker/login-action@v3with:registry: ghcr.iousername: ${{ github.actor }}password: ${{ secrets.GITHUB_TOKEN }}- name: Extract version from tagid: versionrun: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT- name: Build and pushuses: docker/build-push-action@v6with:context: .push: truetags: |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-latestvariables: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: Packrun: dotnet pack src/MyLibrary -c Release -o ./nupkg --no-build- name: Push to NuGetrun: 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
| Scenario | Recommendation | |
|---|---|---|
| Open source project | GitHub Actions | |
| Enterprise with Azure | Azure DevOps Pipelines | |
| Docker deployment | Multi-stage build in CI, push to container registry | |
| NuGet library | Build → Test → Pack → Push on tag | |
| Database migrations | Run in CI test stage, script for production | |
| Environment promotion | Same artifact, different configuration |