-
Notifications
You must be signed in to change notification settings - Fork 6
123 lines (106 loc) · 3.69 KB
/
Copy pathmcp-release.yml
File metadata and controls
123 lines (106 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Codout.Framework.Mcp Release
on:
push:
tags:
- 'mcp-v*'
workflow_dispatch:
inputs:
version:
description: 'Override package version (optional, e.g. 6.2.3)'
required: false
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
PROJECT: Codout.Framework.Mcp/src/Tools/Codout.Framework.Mcp/Codout.Framework.Mcp.csproj
TESTS: Codout.Framework.Mcp/src/Tools/Codout.Framework.Mcp.Tests/Codout.Framework.Mcp.Tests.csproj
CONFIGURATION: Release
jobs:
build-test-pack:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Resolve version
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
VERSION="${{ github.event.inputs.version }}"
elif [[ "${GITHUB_REF}" == refs/tags/mcp-v* ]]; then
VERSION="${GITHUB_REF#refs/tags/mcp-v}"
else
VERSION=""
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "Resolved version: ${VERSION:-<inherit from Directory.Build.props>}"
- name: Restore
run: dotnet restore "$PROJECT"
- name: Restore tests
run: |
if [ -f "$TESTS" ]; then
dotnet restore "$TESTS"
fi
- name: Build
run: dotnet build "$PROJECT" --configuration "$CONFIGURATION" --no-restore
- name: Test
run: |
if [ -f "$TESTS" ]; then
dotnet test "$TESTS" --configuration "$CONFIGURATION" --no-restore --verbosity normal
else
echo "No test project found, skipping."
fi
- name: Validate MCP CLI
run: dotnet run --project "$PROJECT" --configuration "$CONFIGURATION" --no-build -- --validate
- name: Pack
run: |
# Mcp has no internal ProjectReferences today, so -p:Version would
# not actively break anything here, but we still use only
# -p:PackageVersion to stay consistent with release.yml and avoid
# reintroducing the cascade trap if a ProjectReference is added
# later. See release.yml for the full explanation.
if [ -n "${{ steps.version.outputs.version }}" ]; then
dotnet pack "$PROJECT" --configuration "$CONFIGURATION" --no-build \
-p:PackageVersion=${{ steps.version.outputs.version }} \
--output ./artifacts
else
dotnet pack "$PROJECT" --configuration "$CONFIGURATION" --no-build --output ./artifacts
fi
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: codout-framework-mcp-nupkg
path: ./artifacts/*.nupkg
if-no-files-found: error
publish:
needs: build-test-pack
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/mcp-v')
permissions:
contents: read
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: codout-framework-mcp-nupkg
path: ./artifacts
- name: Push to NuGet.org
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
if [ -z "$NUGET_API_KEY" ]; then
echo "NUGET_API_KEY secret is not set; aborting."
exit 1
fi
dotnet nuget push "./artifacts/*.nupkg" \
--api-key "$NUGET_API_KEY" \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate