Updated TokenKit csproj #48
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: .NET Build, Test & Publish | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| tags: | |
| - 'v*' # e.g. v1.1.0, v1.2.3 | |
| pull_request: | |
| branches: [ "master" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build solution | |
| run: dotnet build --no-restore --configuration Release | |
| - name: Run tests with coverage | |
| run: dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --results-directory ./TestResults | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./TestResults/**/*.xml | |
| flags: unittests | |
| name: TokenKit | |
| fail_ci_if_error: false | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| publish: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| # ✅ Pack the Core library | |
| - name: Pack TokenKit.Core | |
| run: dotnet pack src/TokenKit.Core --configuration Release -p:PackageVersion=${GITHUB_REF#refs/tags/v} -o ./nupkg | |
| # ✅ Pack the main CLI/SDK library | |
| - name: Pack TokenKit | |
| run: dotnet pack src/TokenKit --configuration Release -p:PackageVersion=${GITHUB_REF#refs/tags/v} -o ./nupkg | |
| # ✅ Publish all .nupkg files in /nupkg to NuGet.org | |
| - name: Publish to NuGet | |
| run: dotnet nuget push "./nupkg/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |