Merge pull request #22 from NavneetHegde/add_gitaction_workflow #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: Build and Publish Nuget | |
| on: | |
| push: | |
| branches: | |
| - release/* | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # enable GitHub OIDC token issuance for this job | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.0.x' | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --configuration Release --no-restore | |
| - name: Test | |
| run: dotnet test --configuration Release --no-build --verbosity normal | |
| - name: Pack | |
| run: dotnet pack --configuration Release --no-build --output ./nupkg | |
| - name: Nuget Login (OIDC + temp API Key) | |
| uses: Nuget/login@v1 | |
| id: login | |
| with: | |
| user: ${{secrets.NUGET_USER}} | |
| - name: Nuget push | |
| run: dotnet nuget push nupkg/*.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json | |