|  | 
|  | 1 | +# This workflow is triggered by new releases | 
|  | 2 | +# It builds, tests, and publishes to the GitHub NuGet package registry | 
|  | 3 | +name: Release package | 
|  | 4 | + | 
|  | 5 | +on: | 
|  | 6 | +  release: | 
|  | 7 | +    types: [published] | 
|  | 8 | + | 
|  | 9 | +jobs: | 
|  | 10 | +  build: | 
|  | 11 | + | 
|  | 12 | +    runs-on: ubuntu-latest | 
|  | 13 | + | 
|  | 14 | +    steps: | 
|  | 15 | +    - uses: actions/checkout@v4 | 
|  | 16 | + | 
|  | 17 | +    - name: Setup .NET | 
|  | 18 | +      uses: actions/setup-dotnet@v2 | 
|  | 19 | +      with: | 
|  | 20 | +        dotnet-version: | | 
|  | 21 | +          9.0.x | 
|  | 22 | +          8.0.x | 
|  | 23 | +
 | 
|  | 24 | +    # Netfx testing on non-Windows requires mono | 
|  | 25 | +    - name: Setup Mono | 
|  | 26 | +      run: sudo apt-get install -y mono-devel | 
|  | 27 | + | 
|  | 28 | +    - name: Set up Node.js | 
|  | 29 | +      uses: actions/setup-node@v3 | 
|  | 30 | +      with: | 
|  | 31 | +        node-version: '20' | 
|  | 32 | + | 
|  | 33 | +    - name: Install dependencies for tests | 
|  | 34 | +      run: npm install @modelcontextprotocol/server-everything | 
|  | 35 | + | 
|  | 36 | +    - name: Install dependencies for tests | 
|  | 37 | +      run: npm install @modelcontextprotocol/server-memory | 
|  | 38 | + | 
|  | 39 | +    - name: Build and Pack | 
|  | 40 | +      run: dotnet pack --configuration Release --output "${{ github.workspace }}/artifacts/packages" | 
|  | 41 | + | 
|  | 42 | +    - name: Test | 
|  | 43 | +      run: dotnet test --filter '(Execution!=Manual)' --no-build --configuration Release | 
|  | 44 | + | 
|  | 45 | +  publish: | 
|  | 46 | +    name: Publish Package | 
|  | 47 | +    needs: build | 
|  | 48 | +    runs-on: ubuntu-latest | 
|  | 49 | +    steps: | 
|  | 50 | +      - name: Checkout code | 
|  | 51 | +        uses: actions/checkout@v2 | 
|  | 52 | + | 
|  | 53 | +      - name: Download build artifacts | 
|  | 54 | +        uses: actions/download-artifact@v4 | 
|  | 55 | + | 
|  | 56 | +      - name: Upload release asset | 
|  | 57 | +        if: github.event_name == 'release' | 
|  | 58 | +        run: gh release upload ${{ github.event.release.tag_name }} | 
|  | 59 | +          ${{ github.workspace }}/build-artifacts/packages/*.*nupkg | 
|  | 60 | +        env: | 
|  | 61 | +          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | 
|  | 62 | + | 
|  | 63 | +      - name: NuGet authentication for GitHub | 
|  | 64 | +        run: dotnet nuget add source | 
|  | 65 | +          "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" | 
|  | 66 | +          --name "github" | 
|  | 67 | +          --username ${{ github.actor }} | 
|  | 68 | +          --password ${{ secrets.GITHUB_TOKEN }} | 
|  | 69 | +          --store-password-in-clear-text | 
|  | 70 | + | 
|  | 71 | +      - name: Publish to GitHub NuGet package registry | 
|  | 72 | +        run: dotnet nuget push | 
|  | 73 | +            ${{github.workspace}}/build-artifacts/packages/*.nupkg | 
|  | 74 | +            --source "github" | 
|  | 75 | +            --api-key ${{ secrets.GITHUB_TOKEN }} | 
|  | 76 | +            --skip-duplicate | 
0 commit comments