Update dotnet monorepo to 10.0.5 #466
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: CI | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: '10.x' | |
| - name: Check for Tag on Current Commit | |
| run: | | |
| # Fetch all tags from the remote repository | |
| git fetch https://github.com/Evidos/SignhostClientLibrary.git --tags | |
| # Check if the current commit has a tag | |
| CURRENT_TAG=$(git tag --points-at HEAD | head -n 1) | |
| if [ -z "$CURRENT_TAG" ]; then | |
| echo "No tag found on current commit. Skipping release steps." | |
| echo "HAS_TAG=false" >> $GITHUB_ENV | |
| else | |
| echo "Tag found on current commit: $CURRENT_TAG" | |
| # If the tag contains a "v", remove it to get the version (if needed) | |
| VERSION=${CURRENT_TAG#v} | |
| echo "HAS_TAG=true" >> $GITHUB_ENV | |
| echo "LATEST_VERSION=${VERSION}" >> $GITHUB_ENV | |
| echo "Version ${VERSION}" | |
| fi | |
| shell: bash | |
| - name: Clear NuGet Cache | |
| run: dotnet nuget locals all --clear | |
| - name: Install Coverlet | |
| run: dotnet add src/SignhostAPIClient.Tests/SignhostAPIClient.Tests.csproj package coverlet.msbuild --version 3.1.0 | |
| - name: Restore NuGet packages | |
| run: dotnet restore src/SignhostAPIClient.sln | |
| - name: Build solution | |
| run: dotnet build src/SignhostAPIClient.sln -c release | |
| - name: Test with Coverage | |
| run: dotnet test --no-build src/SignhostAPIClient.Tests/SignhostAPIClient.Tests.csproj --collect:"XPlat Code Coverage" -c Release | |
| # Note: Integration tests are excluded from CI/CD as they require live credentials | |
| - name: Pack | |
| run: dotnet pack src/SignhostAPIClient/SignhostAPIClient.csproj /p:Version=${{ env.LATEST_VERSION }} | |
| if: env.HAS_TAG == 'true' && github.ref == 'refs/heads/master' | |
| - name: Upload NuGet Package | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: Nuget | |
| path: '**/*.nupkg' | |
| if: env.HAS_TAG == 'true' && github.ref == 'refs/heads/master' | |
| - name: Publish NuGet Package | |
| run: | | |
| dotnet nuget push '**/*.nupkg' --api-key ${{ secrets.NUGET_KEY }} --source https://api.nuget.org/v3/index.json | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_KEY }} | |
| if: env.HAS_TAG == 'true' && github.ref == 'refs/heads/master' |