-
Notifications
You must be signed in to change notification settings - Fork 43
60 lines (49 loc) · 1.99 KB
/
release.yml
File metadata and controls
60 lines (49 loc) · 1.99 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
name: Release to NuGet
on:
workflow_dispatch:
inputs:
version:
description: 'Version number (e.g., 1.0.0)'
required: true
type: string
jobs:
build-and-publish:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Restore dependencies
run: dotnet restore MCPSharp/MCPSharp.csproj
- name: Build
run: dotnet build MCPSharp/MCPSharp.csproj --no-restore --configuration Release
- name: Test
run: dotnet test MCPSharp/MCPSharp.csproj --no-build --configuration Release --verbosity normal
- name: Pack
run: dotnet pack MCPSharp/MCPSharp.csproj --no-build --configuration Release -p:PackageVersion=${{ github.event.inputs.version }} --output nupkgs
- name: Push to NuGet
run: dotnet nuget push /home/runner/work/MCPSharp/MCPSharp/nupkgs/MCPSharp.${{ github.event.inputs.version }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
- name: Publish Github release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.version }}
release_name: MCPSharp ${{ github.event.inputs.version }}
body: |
Release of MCPSharp version ${{ github.event.inputs.version }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /home/runner/work/MCPSharp/MCPSharp/nupkgs/MCPSharp.${{ github.event.inputs.version }}.nupkg
asset_name: MCPSharp.${{ github.event.inputs.version }}.nupkg
asset_content_type: application/zip