$npx -y skills add wshaddix/dotnet-skills --skill dotnet-cli-release-pipelineReleasing CLI tools. GitHub Actions build matrix, artifact staging, Releases, checksums.
| 1 | # dotnet-cli-release-pipeline |
| 2 | |
| 3 | Unified release CI/CD pipeline for .NET CLI tools: GitHub Actions workflow producing all distribution formats from a single version tag trigger, build matrix per Runtime Identifier (RID), artifact staging between jobs, GitHub Releases with SHA-256 checksums, automated Homebrew formula and winget manifest PR creation, and SemVer versioning strategy with git tags. |
| 4 | |
| 5 | **Version assumptions:** .NET 8.0+ baseline. GitHub Actions workflow syntax v2. Patterns apply to any CI system but examples use GitHub Actions. |
| 6 | |
| 7 | **Scope boundary:** This skill owns the CLI-specific release pipeline -- the build-package-release workflow for CLI tool artifacts. General CI/CD patterns (branch protection, matrix testing strategies, deployment pipelines, reusable workflows) -- see [skill:dotnet-gha-patterns] and [skill:dotnet-ado-patterns]. This skill focuses on the unique requirements of shipping CLI binaries to multiple package managers from a single trigger. |
| 8 | |
| 9 | **Out of scope:** General CI/CD patterns (branch strategies, matrix testing, deployment pipelines) -- see [skill:dotnet-gha-patterns] and [skill:dotnet-ado-patterns]. Native AOT compilation configuration -- see [skill:dotnet-native-aot]. Distribution strategy decisions -- see [skill:dotnet-cli-distribution]. Package format details -- see [skill:dotnet-cli-packaging]. Container image publishing -- see [skill:dotnet-containers]. |
| 10 | |
| 11 | Cross-references: [skill:dotnet-cli-distribution] for RID matrix and publish strategy, [skill:dotnet-cli-packaging] for package format authoring, [skill:dotnet-native-aot] for AOT publish configuration, [skill:dotnet-containers] for container-based distribution. |
| 12 | |
| 13 | --- |
| 14 | |
| 15 | ## Versioning Strategy |
| 16 | |
| 17 | ### SemVer + Git Tags |
| 18 | |
| 19 | Use Semantic Versioning (SemVer) with git tags as the single source of truth for release versions. |
| 20 | |
| 21 | **Tag format:** `v{major}.{minor}.{patch}` (e.g., `v1.2.3`) |
| 22 | |
| 23 | ```bash |
| 24 | # Tag a release |
| 25 | git tag -a v1.2.3 -m "Release v1.2.3" |
| 26 | git push origin v1.2.3 |
| 27 | ``` |
| 28 | |
| 29 | ### Version Flow |
| 30 | |
| 31 | ``` |
| 32 | git tag v1.2.3 |
| 33 | │ |
| 34 | ▼ |
| 35 | GitHub Actions trigger (on push tags: v*) |
| 36 | │ |
| 37 | ▼ |
| 38 | Extract version from tag: GITHUB_REF_NAME → v1.2.3 → 1.2.3 |
| 39 | │ |
| 40 | ▼ |
| 41 | Pass to dotnet publish /p:Version=1.2.3 |
| 42 | │ |
| 43 | ▼ |
| 44 | Embed in binary (--version output) |
| 45 | │ |
| 46 | ▼ |
| 47 | Stamp in package manifests (Homebrew, winget, Scoop, NuGet) |
| 48 | ``` |
| 49 | |
| 50 | ### Extracting Version from Tag |
| 51 | |
| 52 | ```yaml |
| 53 | - name: Extract version from tag |
| 54 | id: version |
| 55 | run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" |
| 56 | # v1.2.3 → 1.2.3 |
| 57 | ``` |
| 58 | |
| 59 | ### Pre-release Versions |
| 60 | |
| 61 | ```bash |
| 62 | # Pre-release tag |
| 63 | git tag -a v1.3.0-rc.1 -m "Release candidate 1" |
| 64 | |
| 65 | # CI detects pre-release and skips package manager submissions |
| 66 | # but still creates GitHub Release as pre-release |
| 67 | ``` |
| 68 | |
| 69 | --- |
| 70 | |
| 71 | ## Unified GitHub Actions Workflow |
| 72 | |
| 73 | ### Complete Workflow |
| 74 | |
| 75 | ```yaml |
| 76 | name: Release |
| 77 | |
| 78 | on: |
| 79 | push: |
| 80 | tags: |
| 81 | - "v[0-9]+.[0-9]+.[0-9]+*" # v1.2.3, v1.2.3-rc.1 |
| 82 | |
| 83 | permissions: |
| 84 | contents: write # Create GitHub Releases |
| 85 | |
| 86 | defaults: |
| 87 | run: |
| 88 | shell: bash |
| 89 | |
| 90 | env: |
| 91 | PROJECT: src/MyCli/MyCli.csproj |
| 92 | DOTNET_VERSION: "8.0.x" |
| 93 | |
| 94 | jobs: |
| 95 | build: |
| 96 | strategy: |
| 97 | matrix: |
| 98 | include: |
| 99 | - rid: linux-x64 |
| 100 | os: ubuntu-latest |
| 101 | - rid: linux-arm64 |
| 102 | os: ubuntu-latest |
| 103 | - rid: osx-arm64 |
| 104 | os: macos-latest |
| 105 | - rid: win-x64 |
| 106 | os: windows-latest |
| 107 | runs-on: ${{ matrix.os }} |
| 108 | steps: |
| 109 | - uses: actions/checkout@v4 |
| 110 | |
| 111 | - uses: actions/setup-dotnet@v4 |
| 112 | with: |
| 113 | dotnet-version: ${{ env.DOTNET_VERSION }} |
| 114 | |
| 115 | - name: Extract version |
| 116 | id: version |
| 117 | shell: bash |
| 118 | run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" |
| 119 | |
| 120 | - name: Publish |
| 121 | run: >- |
| 122 | dotnet publish ${{ env.PROJECT }} |
| 123 | -c Release |
| 124 | -r ${{ matrix.rid }} |
| 125 | -o ./publish |
| 126 | /p:Version=${{ steps.version.outputs.version }} |
| 127 | |
| 128 | - name: Package (Unix) |
| 129 | if: runner.os != 'Windows' |
| 130 | run: | |
| 131 | set -euo pipefail |
| 132 | cd publish |
| 133 | tar -czf "$GITHUB_WORKSPACE/mytool-${{ steps.version.outputs.version }}-${{ matrix.rid }}.tar.gz" . |
| 134 | |
| 135 | - name: Package (Windows) |
| 136 | if: runner.os == 'Windows' |
| 137 | shell: pwsh |
| 138 | run: | |
| 139 | Compress-Archive -Path "publish/*" ` |
| 140 | -DestinationPath "mytool-${{ steps.version.outputs.version }}-${{ matrix.rid }}.zip" |
| 141 | |
| 142 | - name: Upload artifact |
| 143 | uses: actions/upload-artifact@v4 |
| 144 | with: |
| 145 | name: release-${{ matrix.rid }} |
| 146 | path: | |
| 147 | *.tar.gz |
| 148 | *.zip |
| 149 | |
| 150 | release: |
| 151 | needs: build |
| 152 | runs-on: ubuntu-latest |
| 153 | steps: |
| 154 | - name: Extract version |
| 155 | id: version |
| 156 | run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" |
| 157 | |
| 158 | - name: Download all artifacts |
| 159 | uses: actions/download-artifact@v4 |
| 160 | with: |
| 161 | path: artifacts |
| 162 | merge-m |