Fix path #5
Workflow file for this run
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: | |
| push: | |
| tags: | |
| - 'v*' | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
| DOTNET_NOLOGO: true | |
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| 9.0.x | |
| - name: Get version from tag | |
| id: get_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Restore dependencies | |
| run: dotnet restore SharpAssert.sln | |
| - name: Build | |
| run: dotnet build SharpAssert.sln --configuration Release --no-restore -p:Version=${{ steps.get_version.outputs.VERSION }} | |
| - name: Run tests | |
| run: dotnet test SharpAssert.sln --configuration Release --no-build | |
| - name: Create packages | |
| run: | | |
| mkdir -p ./packages | |
| dotnet pack SharpAssert.Runtime/SharpAssert.Runtime.csproj \ | |
| --configuration Release \ | |
| --no-build \ | |
| --output ./packages \ | |
| -p:PackageVersion=${{ steps.get_version.outputs.VERSION }} | |
| dotnet pack SharpAssert/SharpAssert.csproj \ | |
| --configuration Release \ | |
| --no-build \ | |
| --output ./packages \ | |
| -p:PackageVersion=${{ steps.get_version.outputs.VERSION }} | |
| - name: Verify packages | |
| run: | | |
| echo "Created packages:" | |
| ls -la ./packages/ | |
| echo "Package count: $(ls ./packages/*.nupkg | wc -l)" | |
| - name: Test packages locally | |
| run: | | |
| # Create temporary local feed for testing | |
| mkdir -p test-feed | |
| cp ./packages/*.nupkg test-feed/ | |
| echo "Testing packages in test-feed:" | |
| ls -la test-feed/ | |
| - name: Publish to NuGet | |
| run: | | |
| # Publish Runtime package first (dependency) | |
| echo "Publishing SharpAssert.Runtime (dependency)..." | |
| dotnet nuget push ./packages/SharpAssert.Runtime.*.nupkg \ | |
| --api-key ${{ secrets.NUGET_API_KEY }} \ | |
| --source https://api.nuget.org/v3/index.json \ | |
| --skip-duplicate | |
| # Publish main package git (depends on Runtime) | |
| echo "Publishing SharpAssert (main package)..." | |
| dotnet nuget push ./packages/SharpAssert.*.nupkg \ | |
| --api-key ${{ secrets.NUGET_API_KEY }} \ | |
| --source https://api.nuget.org/v3/index.json \ | |
| --skip-duplicate | |
| - name: Create GitHub Release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref }} | |
| release_name: Release ${{ steps.get_version.outputs.VERSION }} | |
| draft: false | |
| prerelease: false |