| 1 | # nuget.org → AIGuiders.McpToolManifest → Trusted Publishing → GitHub: |
| 2 | # Owner: KarataevDmitry, Repository: mcp-tool-manifest, Workflow: nuget-publish.yml |
| 3 | name Publish to NuGet |
| 4 | |
| 5 | on |
| 6 | workflow_dispatch: |
| 7 | inputs: |
| 8 | package_version: |
| 9 | description: 'Версия пакета (SemVer, напр. 1.0.0)' |
| 10 | required: true |
| 11 | type: string |
| 12 | push: |
| 13 | tags: |
| 14 | - 'v*' |
| 15 | |
| 16 | permissions |
| 17 | contents: read |
| 18 | id-token: write |
| 19 | |
| 20 | jobs |
| 21 | publish: |
| 22 | runs-on: ubuntu-latest |
| 23 | steps: |
| 24 | - uses: actions/checkout@v4 |
| 25 | |
| 26 | - uses: actions/setup-dotnet@v4 |
| 27 | with: |
| 28 | dotnet-version: '10.0.x' |
| 29 | |
| 30 | - name: Версия пакета |
| 31 | shell: bash |
| 32 | run: | |
| 33 | set -euo pipefail |
| 34 | if [ "${{ github.ref_type }}" = "tag" ]; then |
| 35 | v="${GITHUB_REF_NAME#v}" |
| 36 | echo "PKG_VERSION=$v" >> "$GITHUB_ENV" |
| 37 | else |
| 38 | echo "PKG_VERSION=${{ github.event.inputs.package_version }}" >> "$GITHUB_ENV" |
| 39 | fi |
| 40 | |
| 41 | - name: Pack (Release) |
| 42 | run: dotnet pack McpToolManifest.csproj -c Release -o nupkg -p:PackageVersion="${PKG_VERSION}" |
| 43 | |
| 44 | - name: NuGet login (OIDC) |
| 45 | uses: NuGet/login@v1 |
| 46 | id: nuget_login |
| 47 | with: |
| 48 | user: LonelySoul |
| 49 | |
| 50 | - name: Push nupkg / snupkg |
| 51 | shell: bash |
| 52 | run: | |
| 53 | set -euo pipefail |
| 54 | key="${{ steps.nuget_login.outputs.NUGET_API_KEY }}" |
| 55 | src="https://api.nuget.org/v3/index.json" |
| 56 | shopt -s nullglob |
| 57 | for f in nupkg/*.nupkg; do |
| 58 | dotnet nuget push "$f" --api-key "$key" --source "$src" --skip-duplicate |
| 59 | done |
| 60 | declare -A seen=() |
| 61 | for f in nupkg/*.snupkg; do |
| 62 | base=$(basename "$f") |
| 63 | if [[ -n "${seen[$base]:-}" ]]; then continue; fi |
| 64 | seen[$base]=1 |
| 65 | dotnet nuget push "$f" --api-key "$key" --source "$src" --skip-duplicate |
| 66 | done |
| 67 | |
View only · write via MCP/CIDE