Add tc-mcp MCP server #10
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: [master, 'release/**'] | |
| permissions: | |
| contents: write | |
| checks: write | |
| env: | |
| DOTNET_NOLOGO: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| jobs: | |
| build-test-pack: | |
| name: Build, Test, Pack | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 # Nerdbank.GitVersioning needs full history | |
| - name: Prepare release branch | |
| if: startsWith(github.ref, 'refs/heads/release/') | |
| shell: pwsh | |
| run: | | |
| $content = Get-Content version.json -Raw | |
| if ($content -match '"version"\s*:\s*"[^"]*-') { | |
| $content = $content -replace '("version"\s*:\s*"[^"]*)-[^"]*"', '$1"' | |
| Set-Content version.json $content -NoNewline | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add version.json | |
| git commit -m "chore: strip pre-release tag for release branch" | |
| git push | |
| } | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1 | |
| with: | |
| dotnet-version: '10.0.x' | |
| dotnet-quality: ga | |
| - name: Restore | |
| run: dotnet restore src/TenantCloud.slnx --force | |
| - name: Build | |
| run: dotnet build src/TenantCloud.slnx -c Release -warnaserror --no-restore | |
| - name: Test | |
| run: >- | |
| dotnet test --solution src/TenantCloud.slnx | |
| -c Release | |
| --no-build | |
| --results-directory TestResults | |
| -- | |
| --report-trx | |
| --coverage | |
| --coverage-output-format cobertura | |
| - name: Test report | |
| if: always() | |
| uses: dorny/test-reporter@v1 | |
| with: | |
| name: Test Results | |
| path: 'TestResults/**/*.trx' | |
| reporter: dotnet-trx | |
| - name: Coverage summary | |
| if: always() | |
| shell: pwsh | |
| run: | | |
| $coberturaFiles = Get-ChildItem -Path TestResults -Filter '*.cobertura.xml' -Recurse -ErrorAction SilentlyContinue | |
| if (-not $coberturaFiles -or $coberturaFiles.Count -eq 0) { | |
| Write-Host 'No Cobertura coverage files found — skipping summary.' | |
| exit 0 | |
| } | |
| foreach ($file in $coberturaFiles) { | |
| [xml]$xml = Get-Content $file.FullName | |
| $lineRate = [math]::Round([double]$xml.coverage.'line-rate' * 100, 1) | |
| $branchRate = [math]::Round([double]$xml.coverage.'branch-rate' * 100, 1) | |
| "## Code Coverage`n" | Out-File -Append $env:GITHUB_STEP_SUMMARY | |
| "| Metric | Value |" | Out-File -Append $env:GITHUB_STEP_SUMMARY | |
| "|--------|-------|" | Out-File -Append $env:GITHUB_STEP_SUMMARY | |
| "| Line coverage | ${lineRate}% |" | Out-File -Append $env:GITHUB_STEP_SUMMARY | |
| "| Branch coverage | ${branchRate}% |" | Out-File -Append $env:GITHUB_STEP_SUMMARY | |
| Write-Host "Line coverage: ${lineRate}%, Branch coverage: ${branchRate}%" | |
| } | |
| - name: Pack | |
| run: dotnet pack src/TenantCloud.slnx -c Release --no-restore -o ${{ runner.temp }}/packages | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: test-results | |
| path: TestResults/** | |
| retention-days: 14 | |
| - name: Upload packages | |
| if: success() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: packages | |
| path: ${{ runner.temp }}/packages/*.nupkg | |
| retention-days: 14 | |
| - name: Resolve version | |
| id: version | |
| if: success() && github.event_name == 'push' | |
| shell: pwsh | |
| run: | | |
| dotnet tool install -g nbgv | |
| $v = nbgv get-version -v NuGetPackageVersion | |
| echo "version=$v" >> $env:GITHUB_OUTPUT | |
| - name: Publish to NuGet | |
| if: success() && github.event_name == 'push' | |
| run: >- | |
| dotnet nuget push "${{ runner.temp }}/packages/*.nupkg" | |
| --source https://api.nuget.org/v3/index.json | |
| --api-key ${{ secrets.NUGET_API_KEY }} | |
| --skip-duplicate | |
| publish-binaries: | |
| name: Publish Binaries | |
| needs: build-test-pack | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| rid: ${{ github.event_name == 'push' && fromJson('["any","win-x64","win-arm64","osx-x64","osx-arm64","linux-x64","linux-arm64"]') || fromJson('["any","win-x64"]') }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1 | |
| with: | |
| dotnet-version: '10.0.x' | |
| dotnet-quality: ga | |
| - name: Publish for ${{ matrix.rid }} | |
| if: matrix.rid != 'any' | |
| run: >- | |
| dotnet publish | |
| src/Yllibed.TenantCloudClient.Mcp/Yllibed.TenantCloudClient.Mcp.csproj | |
| -c Release | |
| -r ${{ matrix.rid }} | |
| -o publish/${{ matrix.rid }} | |
| - name: Publish portable | |
| if: matrix.rid == 'any' | |
| run: >- | |
| dotnet publish | |
| src/Yllibed.TenantCloudClient.Mcp/Yllibed.TenantCloudClient.Mcp.csproj | |
| -c Release | |
| -p:SelfContained=false | |
| -p:PublishSingleFile=false | |
| -p:PublishTrimmed=false | |
| -p:PublishReadyToRun=false | |
| -o publish/any | |
| - name: Upload binary | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: tc-mcp-${{ matrix.rid }} | |
| path: publish/${{ matrix.rid }}/tc-mcp* | |
| retention-days: 14 | |
| release: | |
| name: Create Release | |
| needs: [build-test-pack, publish-binaries] | |
| if: success() && github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1 | |
| with: | |
| dotnet-version: '10.0.x' | |
| dotnet-quality: ga | |
| - name: Resolve version | |
| id: version | |
| shell: pwsh | |
| run: | | |
| dotnet tool install -g nbgv | |
| $v = nbgv get-version -v NuGetPackageVersion | |
| echo "version=$v" >> $env:GITHUB_OUTPUT | |
| - name: Download packages | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: packages | |
| path: artifacts/packages | |
| - name: Download binaries | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| pattern: tc-mcp-* | |
| path: artifacts/binaries | |
| merge-multiple: false | |
| - name: Prepare release assets | |
| shell: bash | |
| run: | | |
| mkdir -p release-assets | |
| cp artifacts/packages/*.nupkg release-assets/ 2>/dev/null || true | |
| for dir in artifacts/binaries/tc-mcp-*/; do | |
| rid=$(basename "$dir" | sed 's/tc-mcp-//') | |
| if [ "$rid" = "any" ]; then | |
| # Portable build: zip all non-debug files | |
| (cd "$dir" && zip -j "../../release-assets/tc-mcp-any.zip" \ | |
| $(ls tc-mcp* | grep -v '\.pdb$' | grep -v '\.xml$')) | |
| continue | |
| fi | |
| for f in "$dir"tc-mcp*; do | |
| [ -f "$f" ] || continue | |
| ext="${f##*.}" | |
| if [ "$ext" = "pdb" ] || [ "$ext" = "xml" ]; then | |
| continue | |
| fi | |
| if [ "$ext" = "$(basename "$f")" ]; then | |
| cp "$f" "release-assets/tc-mcp-${rid}" | |
| else | |
| cp "$f" "release-assets/tc-mcp-${rid}.${ext}" | |
| fi | |
| done | |
| done | |
| ls -la release-assets/ | |
| - name: Create GitHub Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: >- | |
| gh release create "v${{ steps.version.outputs.version }}" | |
| release-assets/* | |
| --title "v${{ steps.version.outputs.version }}" | |
| --generate-notes | |
| ${{ contains(steps.version.outputs.version, '-') && '--prerelease' || '' }} |