Bump xunit.runner.visualstudio from 3.1.4 to 3.1.5 #22
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: Build and Release NuGet Package | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| env: | |
| GLOBAL_JSON_PATH: './src/global.json' | |
| PROJECT_PATH: './src/dotnet.library.sln' | |
| PACKAGE_OUTPUT_DIRECTORY: './packages' | |
| TEST_OUTPUT_DIRECTORY: './testresults' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| permissions: | |
| contents: read | |
| # For a list of available runner types, refer to | |
| # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
| runs-on: ubuntu-latest | |
| outputs: | |
| semVer: ${{ steps.gitversion.outputs.semVer }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| # Install the .NET Core workload | |
| - name: Install .NET Core | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: ${{ env.GLOBAL_JSON_PATH }} | |
| - name: Restore tools | |
| run: dotnet tool restore | |
| - name: Run Slopwatch | |
| run: dotnet tool run slopwatch analyze --fail-on error | |
| - name: Install GitVersion | |
| uses: gittools/actions/gitversion/setup@v1.1.1 | |
| with: | |
| versionSpec: '5.x' | |
| - name: Determine Version | |
| uses: gittools/actions/gitversion/execute@v1.1.1 | |
| id: gitversion | |
| - name: Display GitVersion outputs | |
| run: | | |
| echo "Release Version: ${{ steps.gitversion.outputs.majorMinorPatch }}" | |
| echo "Nuget Version: ${{ steps.gitversion.outputs.fullSemVer }}" | |
| - name: Restore dependencies | |
| run: dotnet restore ${{ env.PROJECT_PATH }} | |
| - name: Build | |
| run: > | |
| dotnet build | |
| --configuration Release | |
| --no-restore | |
| ${{ env.PROJECT_PATH }} | |
| /p:Version=${{ steps.gitversion.outputs.semVer }} | |
| - name: Run tests | |
| run: > | |
| dotnet test | |
| --configuration Release | |
| --no-build | |
| --collect:"XPlat Code Coverage;Format=opencover" | |
| --logger trx | |
| --results-directory ${{ env.TEST_OUTPUT_DIRECTORY }} | |
| --verbosity normal | |
| ${{ env.PROJECT_PATH }} | |
| - name: Create NuGet package | |
| run: > | |
| dotnet pack | |
| --configuration Release | |
| --no-build | |
| --output ${{ env.PACKAGE_OUTPUT_DIRECTORY }} | |
| ${{ env.PROJECT_PATH }} | |
| /p:PackageVersion=${{ steps.gitversion.outputs.semVer }} | |
| - name: Upload package artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: nuget-packages | |
| path: ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg | |
| publish: | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' && false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| - name: Download package artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: nuget-packages | |
| path: ${{ env.PACKAGE_OUTPUT_DIRECTORY }} | |
| - name: Setup .NET Core | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| global-json-file: ${{ env.GLOBAL_JSON_PATH }} | |
| - name: Publish to NuGet | |
| run: | | |
| dotnet nuget push --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg | |
| - name: Create & Publish Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: "v${{ needs.build.outputs.semVer }}" | |
| target_commitish: ${{ github.sha }} | |
| name: "v${{ needs.build.outputs.semVer }}" | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: false | |
| make_latest: true | |
| files: ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg |