Publish to NuGet #10
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: Publish to NuGet | |
| on: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Package version (e.g., 1.0.0)' | |
| required: false | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Build | |
| run: dotnet build --configuration Release | |
| - name: Pack | |
| run: dotnet pack --configuration Release --no-build --output ./artifacts | |
| - name: List packages | |
| run: | | |
| echo "Contents of artifacts directory:" | |
| ls -la ./artifacts/ || echo "Directory not found" | |
| echo "Looking for .nupkg files:" | |
| find ./artifacts -name "*.nupkg" 2>/dev/null || echo "No packages found" | |
| - name: Publish to NuGet | |
| run: | | |
| for package in ./artifacts/*.nupkg; do | |
| if [ -f "$package" ]; then | |
| echo "Publishing $package..." | |
| dotnet nuget push "$package" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| fi | |
| done |